Documentation
¶
Index ¶
- func RegisterGlobalMetadata(pluginName string, metadata *PluginMetadata)
- func RegisterGlobalTool(toolType string, factory func() Tool) error
- type CallResult
- type Context
- type DefaultRegistry
- func (r *DefaultRegistry) GetMetadata(pluginName string) (*PluginMetadata, error)
- func (r *DefaultRegistry) GetTool(toolType string) (Tool, error)
- func (r *DefaultRegistry) ListTools() []string
- func (r *DefaultRegistry) RegisterMetadata(pluginName string, metadata *PluginMetadata)
- func (r *DefaultRegistry) RegisterTool(toolType string, factory func() Tool) error
- type Logger
- type Manager
- func (m *Manager) DisableTool(name string) error
- func (m *Manager) EnableTool(name string) error
- func (m *Manager) GetContext() *Context
- func (m *Manager) GetTool(name string) (Tool, error)
- func (m *Manager) ListLoadedTools() []string
- func (m *Manager) LoadTool(name, toolType string, config map[string]interface{}) error
- func (m *Manager) UnloadTool(name string) error
- type MethodInfo
- type PluginMetadata
- type PluginRegistry
- type SecretManager
- type Tool
- type ToolConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterGlobalMetadata ¶
func RegisterGlobalMetadata(pluginName string, metadata *PluginMetadata)
RegisterGlobalMetadata registers metadata in the global registry
func RegisterGlobalTool ¶
RegisterGlobalTool registers a tool in the global registry
Types ¶
type CallResult ¶
type CallResult struct {
Content interface{} `json:"content"`
IsText bool `json:"isText"`
Error string `json:"error,omitempty"`
}
CallResult represents the result of a tool method call
type Context ¶
type Context struct {
// SecretManager provides access to secrets
SecretManager SecretManager
// Logger provides logging capabilities
Logger Logger
// Config provides access to plugin configuration
Config map[string]interface{}
// ProjectRoot is the root directory of the project
ProjectRoot string
}
Context provides shared services to plugins
type DefaultRegistry ¶
type DefaultRegistry struct {
// contains filtered or unexported fields
}
DefaultRegistry provides the default plugin registry implementation
func (*DefaultRegistry) GetMetadata ¶
func (r *DefaultRegistry) GetMetadata(pluginName string) (*PluginMetadata, error)
GetMetadata returns plugin metadata
func (*DefaultRegistry) GetTool ¶
func (r *DefaultRegistry) GetTool(toolType string) (Tool, error)
GetTool creates a tool instance by type
func (*DefaultRegistry) ListTools ¶
func (r *DefaultRegistry) ListTools() []string
ListTools returns all registered tool types
func (*DefaultRegistry) RegisterMetadata ¶
func (r *DefaultRegistry) RegisterMetadata(pluginName string, metadata *PluginMetadata)
RegisterMetadata registers metadata for a plugin
func (*DefaultRegistry) RegisterTool ¶
func (r *DefaultRegistry) RegisterTool(toolType string, factory func() Tool) error
RegisterTool registers a tool type with a factory function
type Logger ¶
type Logger interface {
Debug(msg string, args ...interface{})
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
}
Logger interface for plugin logging
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages plugin lifecycle and provides runtime services
func NewManager ¶
func NewManager(registry PluginRegistry, context *Context) *Manager
NewManager creates a new plugin manager
func (*Manager) DisableTool ¶
DisableTool disables a tool
func (*Manager) EnableTool ¶
EnableTool enables a tool
func (*Manager) GetContext ¶
GetContext returns the plugin context
func (*Manager) ListLoadedTools ¶
ListLoadedTools returns all loaded tool names
func (*Manager) UnloadTool ¶
UnloadTool removes a tool from the manager
type MethodInfo ¶
type MethodInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
Required []string `json:"required,omitempty"`
}
MethodInfo describes a tool method
type PluginMetadata ¶
type PluginMetadata struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author,omitempty"`
Tags []string `json:"tags,omitempty"`
Homepage string `json:"homepage,omitempty"`
Repository string `json:"repository,omitempty"`
License string `json:"license,omitempty"`
Keywords []string `json:"keywords,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
}
Plugin metadata
type PluginRegistry ¶
type PluginRegistry interface {
// RegisterTool registers a tool type
RegisterTool(toolType string, factory func() Tool) error
// GetTool creates a tool instance by type
GetTool(toolType string) (Tool, error)
// ListTools returns all registered tool types
ListTools() []string
// GetMetadata returns plugin metadata
GetMetadata(pluginName string) (*PluginMetadata, error)
}
PluginRegistry manages plugin registration and discovery
func GetGlobalRegistry ¶
func GetGlobalRegistry() PluginRegistry
GetGlobalRegistry returns the global plugin registry
type SecretManager ¶
type SecretManager interface {
Get(key string) (string, error)
GetAll() (map[string]string, error)
Exists(key string) bool
ListKeys() ([]string, error)
SanitizeForMCP(data interface{}) interface{}
}
SecretManager interface for accessing secrets
type Tool ¶
type Tool interface {
// Name returns the unique name of this tool
Name() string
// Description returns a human-readable description of the tool
Description() string
// Methods returns the list of available methods for this tool
Methods() []MethodInfo
// Call executes a method with the given parameters
Call(ctx context.Context, method string, params map[string]interface{}) (*CallResult, error)
// Dependencies returns the list of dependencies this tool requires
Dependencies() []string
// Config returns the configuration schema for this tool
Config() ToolConfig
// Initialize sets up the tool with the given configuration
Initialize(config map[string]interface{}) error
// IsEnabled returns whether this tool is currently enabled
IsEnabled() bool
// SetEnabled sets the enabled state of this tool
SetEnabled(enabled bool)
}
Tool represents an MCP tool plugin