Documentation
¶
Overview ¶
Package services Description: This file contains the implementation of the CommandServer interface for MacOS and Linux.
Index ¶
- Constants
- type CommandConfig
- type CommandServer
- type Config
- type FileInfo
- type FileSystemConfig
- type FilesystemServer
- type MLService
- func (mls *MLService) AddNotificationHandler(name string, handler server.NotificationHandlerFunc)
- func (mls *MLService) AddPrompt(pe PromptEntry)
- func (mls *MLService) AddResource(rs mcp.Resource, hr server.ResourceHandlerFunc)
- func (mls *MLService) AddResourceTemplate(rt mcp.ResourceTemplate, hr server.ResourceTemplateHandlerFunc)
- func (mls *MLService) AddTool(tool mcp.Tool, handler server.ToolHandlerFunc)
- func (mls *MLService) Ctx() context.Context
- func (mls *MLService) NotificationHandlers() map[string]server.NotificationHandlerFunc
- func (mls *MLService) Prompts() []PromptEntry
- func (mls *MLService) ResourceTemplates() map[mcp.ResourceTemplate]server.ResourceTemplateHandlerFunc
- func (mls *MLService) Resources() map[mcp.Resource]server.ResourceHandlerFunc
- func (mls *MLService) Tools() []server.ServerTool
- type PromptEntry
- type Service
Constants ¶
const ( // MaxInlineSize Maximum size for inline content (5MB) MaxInlineSize = 1024 * 1024 * 5 // MaxBase64Size Maximum size for base64 encoding (1MB) MaxBase64Size = 1024 * 1024 * 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandConfig ¶
type CommandConfig struct {
// contains filtered or unexported fields
}
CommandConfig represents the configuration for allowed commands.
func NewCommandConfig ¶
func NewCommandConfig(commands []string) *CommandConfig
NewCommandConfig creates a new CommandConfig with the given allowed commands.
func (*CommandConfig) Check ¶
func (cc *CommandConfig) Check() error
Check validates the allowed commands in the CommandConfig.
type CommandServer ¶
type CommandServer struct {
MLService
// contains filtered or unexported fields
}
CommandServer implements the Service interface and provides methods to execute named commands.
type Config ¶
type Config interface {
// Check validates the configuration and returns an error if the configuration is invalid.
Check() error
}
Config is an interface that defines a method for checking configuration validity.
type FileSystemConfig ¶
type FileSystemConfig struct {
// contains filtered or unexported fields
}
FileSystemConfig represents the configuration for the file system.
func NewFileSystemConfig ¶
func NewFileSystemConfig(path []string) *FileSystemConfig
NewFileSystemConfig creates a new FileSystemConfig with the given allowed directories.
func (*FileSystemConfig) Check ¶
func (fc *FileSystemConfig) Check() error
Check validates the allowed directories in the FileSystemConfig.
type FilesystemServer ¶
type FilesystemServer struct {
MLService
// contains filtered or unexported fields
}
type MLService ¶
type MLService struct {
// contains filtered or unexported fields
}
MLService implements the Service interface and provides methods to manage resources, templates, prompts, tools, and notification handlers.
func (*MLService) AddNotificationHandler ¶
func (mls *MLService) AddNotificationHandler(name string, handler server.NotificationHandlerFunc)
AddNotificationHandler adds a notification handler to the service.
func (*MLService) AddPrompt ¶
func (mls *MLService) AddPrompt(pe PromptEntry)
AddPrompt adds a prompt and its handler function to the service.
func (*MLService) AddResource ¶
func (mls *MLService) AddResource(rs mcp.Resource, hr server.ResourceHandlerFunc)
AddResource adds a resource and its handler function to the service.
func (*MLService) AddResourceTemplate ¶
func (mls *MLService) AddResourceTemplate(rt mcp.ResourceTemplate, hr server.ResourceTemplateHandlerFunc)
AddResourceTemplate adds a resource template and its handler function to the service.
func (*MLService) AddTool ¶
func (mls *MLService) AddTool(tool mcp.Tool, handler server.ToolHandlerFunc)
AddTool adds a tool and its handler function to the service.
func (*MLService) NotificationHandlers ¶
func (mls *MLService) NotificationHandlers() map[string]server.NotificationHandlerFunc
NotificationHandlers returns the map of notification handlers.
func (*MLService) Prompts ¶
func (mls *MLService) Prompts() []PromptEntry
Prompts returns the map of prompts and their handler functions.
func (*MLService) ResourceTemplates ¶
func (mls *MLService) ResourceTemplates() map[mcp.ResourceTemplate]server.ResourceTemplateHandlerFunc
ResourceTemplates returns the map of resource templates and their handler functions.
func (*MLService) Resources ¶
func (mls *MLService) Resources() map[mcp.Resource]server.ResourceHandlerFunc
Resources returns the map of resources and their handler functions.
func (*MLService) Tools ¶
func (mls *MLService) Tools() []server.ServerTool
Tools returns the slice of server tools.
type PromptEntry ¶
type PromptEntry struct {
// contains filtered or unexported fields
}
func (*PromptEntry) Handler ¶
func (pe *PromptEntry) Handler() server.PromptHandlerFunc
func (*PromptEntry) Prompt ¶
func (pe *PromptEntry) Prompt() mcp.Prompt
type Service ¶
type Service interface {
Ctx() context.Context
// Resources returns a map of resources and their corresponding handler functions.
Resources() map[mcp.Resource]server.ResourceHandlerFunc
// ResourceTemplates returns a map of resource templates and their corresponding handler functions.
ResourceTemplates() map[mcp.ResourceTemplate]server.ResourceTemplateHandlerFunc
// Prompts returns a map of prompts and their corresponding handler functions.
Prompts() []PromptEntry
// Tools returns a slice of server tools.
Tools() []server.ServerTool
// NotificationHandlers returns a map of notification handlers.
NotificationHandlers() map[string]server.NotificationHandlerFunc
}
Service defines the interface for a service with various handlers and tools.
func NewCommandServer ¶
NewCommandServer creates a new CommandServer with the given allowed commands.