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 NewMCPServer(ctx context.Context, transport transport.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 MCPServer
- 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
- type MCPToolAdapter
- func (a *MCPToolAdapter) Description() string
- func (a *MCPToolAdapter) Execute(ctx context.Context, args string) (string, error)
- func (a *MCPToolAdapter) InputSchema() map[string]interfaces.ParameterSpec
- 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 StdioServerConfig
- type Tool
- type ToolResponse
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
func NewMCPServer ¶
NewMCPServer creates a new MCPServer with the given transport
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
Types ¶
type HTTPServerConfig ¶
HTTPServerConfig holds configuration for an HTTP MCP server
type MCPServer ¶
type MCPServer interface {
// Initialize initializes the connection to the MCP server
Initialize(ctx context.Context) error
// ListTools lists the tools available on the MCP server
ListTools(ctx context.Context) ([]interfaces.MCPTool, error)
// CallTool calls a tool on the MCP server
CallTool(ctx context.Context, name string, args interface{}) (*interfaces.MCPToolResponse, error)
// Close closes the connection to the MCP server
Close() error
}
MCPServer represents a connection to an MCP server
type MCPServerImpl ¶
type MCPServerImpl struct {
// contains filtered or unexported fields
}
MCPServerImpl is the implementation of interfaces.MCPServer
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) 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) InputSchema ¶
func (a *MCPToolAdapter) InputSchema() map[string]interfaces.ParameterSpec
InputSchema returns the schema for the tool's input
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 StdioServerConfig ¶
StdioServerConfig holds configuration for a stdio MCP server
type ToolResponse ¶
ToolResponse represents a response from a tool call