Documentation
¶
Index ¶
- func ConvertMCPTools(server interfaces.MCPServer, mcpTools []map[string]interface{}) ([]interfaces.Tool, error)
- func FetchMCPToolsFromServer(ctx context.Context, url string) ([]map[string]interface{}, error)
- func NewHTTPServer(ctx context.Context, config HTTPServerConfig) (interfaces.MCPServer, error)
- func NewLazyMCPTool(name, description string, schema interface{}, config LazyMCPServerConfig) interfaces.Tool
- func NewMCPServer(ctx context.Context, transport mcp.Transport) (interfaces.MCPServer, error)
- func NewMCPTool(name, description string, schema interface{}, server interfaces.MCPServer) interfaces.Tool
- func NewStdioServer(ctx context.Context, config StdioServerConfig) (interfaces.MCPServer, error)
- func RunStdioToolCommand(cmd *exec.Cmd, payload []byte) ([]byte, error)
- type HTTPServerConfig
- type LazyMCPServerCache
- type LazyMCPServerConfig
- type LazyMCPTool
- func (t *LazyMCPTool) Description() string
- func (t *LazyMCPTool) DisplayName() string
- func (t *LazyMCPTool) Execute(ctx context.Context, args string) (string, error)
- func (t *LazyMCPTool) Internal() bool
- func (t *LazyMCPTool) Name() string
- func (t *LazyMCPTool) Parameters() map[string]interfaces.ParameterSpec
- func (t *LazyMCPTool) Run(ctx context.Context, input string) (string, error)
- type MCPServerImpl
- func (s *MCPServerImpl) CallTool(ctx context.Context, name string, args interface{}) (*interfaces.MCPToolResponse, error)
- func (s *MCPServerImpl) Close() error
- func (s *MCPServerImpl) Initialize(ctx context.Context) error
- func (s *MCPServerImpl) ListTools(ctx context.Context) ([]interfaces.MCPTool, error)
- type MCPTool
- func (t *MCPTool) Description() string
- func (t *MCPTool) DisplayName() string
- func (t *MCPTool) Execute(ctx context.Context, args string) (string, error)
- func (t *MCPTool) Internal() bool
- func (t *MCPTool) Name() string
- func (t *MCPTool) Parameters() map[string]interfaces.ParameterSpec
- func (t *MCPTool) Run(ctx context.Context, input string) (string, error)
- type MCPToolAdapter
- func (a *MCPToolAdapter) Description() string
- func (a *MCPToolAdapter) DisplayName() string
- func (a *MCPToolAdapter) Execute(ctx context.Context, args string) (string, error)
- func (a *MCPToolAdapter) InputSchema() map[string]interfaces.ParameterSpec
- func (a *MCPToolAdapter) Internal() bool
- func (a *MCPToolAdapter) Name() string
- func (a *MCPToolAdapter) Parameters() map[string]interfaces.ParameterSpec
- func (a *MCPToolAdapter) Run(ctx context.Context, input string) (string, error)
- type MCPToolResponse
- type ParameterSpec
- type ServerProtocolType
- type StdioServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertMCPTools ¶
func ConvertMCPTools(server interfaces.MCPServer, mcpTools []map[string]interface{}) ([]interfaces.Tool, error)
ConvertMCPTools converts a list of MCP tools to agent SDK tools
func FetchMCPToolsFromServer ¶
FetchMCPToolsFromServer fetches the list of tools from an MCP server
func NewHTTPServer ¶
func NewHTTPServer(ctx context.Context, config HTTPServerConfig) (interfaces.MCPServer, error)
NewHTTPServer creates a new MCPServer that communicates over HTTP using the official SDK
func NewLazyMCPTool ¶
func NewLazyMCPTool(name, description string, schema interface{}, config LazyMCPServerConfig) interfaces.Tool
NewLazyMCPTool creates a new lazy MCP tool
func NewMCPServer ¶
NewMCPServer creates a new MCPServer with the given transport using the official SDK
func NewMCPTool ¶
func NewMCPTool(name, description string, schema interface{}, server interfaces.MCPServer) interfaces.Tool
NewMCPTool creates a new MCPTool
func NewStdioServer ¶
func NewStdioServer(ctx context.Context, config StdioServerConfig) (interfaces.MCPServer, error)
NewStdioServer creates a new MCPServer that communicates over stdio using the official SDK
Types ¶
type HTTPServerConfig ¶
type HTTPServerConfig struct {
BaseURL string
Path string
Token string
ProtocolType ServerProtocolType
}
HTTPServerConfig holds configuration for an HTTP MCP server
type LazyMCPServerCache ¶
type LazyMCPServerCache struct {
// contains filtered or unexported fields
}
LazyMCPServerCache manages shared MCP server instances
type LazyMCPServerConfig ¶
type LazyMCPServerConfig struct {
Name string
Type string // "stdio" or "http"
Command string
Args []string
Env []string
URL string
}
LazyMCPServerConfig holds configuration for creating an MCP server on demand
type LazyMCPTool ¶
type LazyMCPTool struct {
// contains filtered or unexported fields
}
LazyMCPTool is a tool that initializes its MCP server on first use
func (*LazyMCPTool) Description ¶
func (t *LazyMCPTool) Description() string
Description returns a description of what the tool does
func (*LazyMCPTool) DisplayName ¶
func (t *LazyMCPTool) DisplayName() string
DisplayName implements interfaces.ToolWithDisplayName.DisplayName
func (*LazyMCPTool) Internal ¶
func (t *LazyMCPTool) Internal() bool
Internal implements interfaces.InternalTool.Internal
func (*LazyMCPTool) Parameters ¶
func (t *LazyMCPTool) Parameters() map[string]interfaces.ParameterSpec
Parameters returns the parameters that the tool accepts
type MCPServerImpl ¶
type MCPServerImpl struct {
// contains filtered or unexported fields
}
MCPServerImpl is the implementation of interfaces.MCPServer using the official SDK
func (*MCPServerImpl) CallTool ¶
func (s *MCPServerImpl) CallTool(ctx context.Context, name string, args interface{}) (*interfaces.MCPToolResponse, error)
CallTool calls a tool on the MCP server
func (*MCPServerImpl) Close ¶
func (s *MCPServerImpl) Close() error
Close closes the connection to the MCP server
func (*MCPServerImpl) Initialize ¶
func (s *MCPServerImpl) Initialize(ctx context.Context) error
Initialize initializes the connection to the MCP server
func (*MCPServerImpl) ListTools ¶
func (s *MCPServerImpl) ListTools(ctx context.Context) ([]interfaces.MCPTool, error)
ListTools lists the tools available on the MCP server
type MCPTool ¶
type MCPTool struct {
// contains filtered or unexported fields
}
MCPTool implements interfaces.Tool for MCP tools
func (*MCPTool) Description ¶
Description returns a description of what the tool does
func (*MCPTool) DisplayName ¶
DisplayName implements interfaces.ToolWithDisplayName.DisplayName
func (*MCPTool) Parameters ¶
func (t *MCPTool) Parameters() map[string]interfaces.ParameterSpec
Parameters returns the parameters that the tool accepts
type MCPToolAdapter ¶
type MCPToolAdapter struct {
// contains filtered or unexported fields
}
MCPToolAdapter converts MCP tools to the agent SDK tool interface
func NewMCPToolAdapter ¶
func NewMCPToolAdapter(server interfaces.MCPServer, name, description string, params map[string]ParameterSpec) *MCPToolAdapter
NewMCPToolAdapter creates a new adapter for an MCP tool
func (*MCPToolAdapter) Description ¶
func (a *MCPToolAdapter) Description() string
Description returns the description of the tool
func (*MCPToolAdapter) DisplayName ¶
func (a *MCPToolAdapter) DisplayName() string
DisplayName implements interfaces.ToolWithDisplayName.DisplayName
func (*MCPToolAdapter) InputSchema ¶
func (a *MCPToolAdapter) InputSchema() map[string]interfaces.ParameterSpec
InputSchema returns the schema for the tool's input
func (*MCPToolAdapter) Internal ¶
func (a *MCPToolAdapter) Internal() bool
Internal implements interfaces.InternalTool.Internal
func (*MCPToolAdapter) Name ¶
func (a *MCPToolAdapter) Name() string
Name returns the name of the tool
func (*MCPToolAdapter) Parameters ¶
func (a *MCPToolAdapter) Parameters() map[string]interfaces.ParameterSpec
Parameters returns the parameters that the tool accepts
type MCPToolResponse ¶
type MCPToolResponse struct {
Content interface{} `json:"content"`
Error string `json:"error,omitempty"`
Text string `json:"text,omitempty"`
}
MCPToolResponse represents the response from an MCP tool call
type ParameterSpec ¶
type ParameterSpec struct {
Type string `json:"type"`
Description string `json:"description"`
Required bool `json:"required"`
}
ParameterSpec represents a parameter specification for an MCP tool
type ServerProtocolType ¶
type ServerProtocolType string
ServerProtocolType defines the protocol type for the MCP server communication Supported types are "streamable" and "sse"
const ( StreamableHTTP ServerProtocolType = "streamable" SSE ServerProtocolType = "sse" )
type StdioServerConfig ¶
StdioServerConfig holds configuration for a stdio MCP server