- Removed the db.go and fs.go files, consolidating database and file system interactions into a unified IO interface. - Updated DSL struct to include db and fs fields for improved separation of concerns. - Refactored existing methods across various DSL managers (API, Connector, MCP, Model) to utilize the new IO interfaces for operations like Inspect, Create, Update, Delete, and List. - Enhanced error handling and validation in Create, Update, and Delete methods to ensure robust functionality. - Updated types to include new options for Load, Unload, and Reload operations, improving flexibility and usability.
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package mcp
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/yaoapp/yao/dsl/types"
|
|
)
|
|
|
|
// YaoMCPServer is the MCP client DSL manager
|
|
type YaoMCPServer struct {
|
|
root string // The relative path of the MCP client DSL
|
|
}
|
|
|
|
// NewServer returns a new MCP server DSL manager
|
|
func NewServer(root string) types.Manager {
|
|
return &YaoMCPServer{root: root}
|
|
}
|
|
|
|
// Loaded return all loaded DSLs
|
|
func (server *YaoMCPServer) Loaded(ctx context.Context) (map[string]*types.Info, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
// Load will unload the DSL first, then load the DSL from DB or file system
|
|
func (server *YaoMCPServer) Load(ctx context.Context, options *types.LoadOptions) error {
|
|
return nil
|
|
}
|
|
|
|
// Unload will unload the DSL from memory
|
|
func (server *YaoMCPServer) Unload(ctx context.Context, options *types.UnloadOptions) error {
|
|
return nil
|
|
}
|
|
|
|
// Reload will unload the DSL first, then reload the DSL from DB or file system
|
|
func (server *YaoMCPServer) Reload(ctx context.Context, options *types.ReloadOptions) error {
|
|
return nil
|
|
}
|
|
|
|
// Validate will validate the DSL from source
|
|
func (server *YaoMCPServer) Validate(ctx context.Context, source string) (bool, []types.LintMessage) {
|
|
return false, nil
|
|
}
|
|
|
|
// Execute will execute the DSL
|
|
func (server *YaoMCPServer) Execute(ctx context.Context, id string, method string, args ...any) (any, error) {
|
|
return nil, nil
|
|
}
|