Documentation
¶
Index ¶
- type ActionToolProvider
- type Chat
- type Connection
- type DocStringInfo
- type MCPConfig
- type MCPHost
- func (h *MCPHost) CloseServers() error
- func (host *MCPHost) ConvertToolsToRecords(tools []MCPTools) []MCPToolRecord
- func (h *MCPHost) ExportToolsToJSON(ctx context.Context, dumpPath string) error
- func (h *MCPHost) GetAllClients() map[string]client.MCPClient
- func (h *MCPHost) GetClient(serverName string) (client.MCPClient, error)
- func (h *MCPHost) GetEinoTool(ctx context.Context, serverName, toolName string) (tool.BaseTool, error)
- func (h *MCPHost) GetEinoToolInfos(ctx context.Context) ([]*schema.ToolInfo, error)
- func (h *MCPHost) GetTool(ctx context.Context, serverName, toolName string) (*mcp.Tool, error)
- func (h *MCPHost) GetTools(ctx context.Context) []MCPTools
- func (h *MCPHost) InitServers(ctx context.Context) error
- func (h *MCPHost) InvokeTool(ctx context.Context, serverName, toolName string, arguments map[string]any) (*mcp.CallToolResult, error)
- func (h *MCPHost) NewChat(ctx context.Context) (*Chat, error)
- func (h *MCPHost) Shutdown()
- type MCPToolRecord
- type MCPTools
- type SSEServerConfig
- type STDIOServerConfig
- type ServerConfig
- type ServerConfigWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionToolProvider ¶
type ActionToolProvider interface {
GetToolByAction(actionName option.ActionName) uixt.ActionTool
}
ActionToolProvider defines the interface for MCP servers that provide ActionTool implementations
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
Chat represents a chat session with LLM
type Connection ¶
type Connection struct {
Client client.MCPClient
Config ServerConfig
}
Connection represents a connection to an MCP server
type DocStringInfo ¶
type DocStringInfo struct {
Description string
Parameters map[string]string
Returns map[string]string
}
DocStringInfo contains the parsed information from a Python docstring
type MCPConfig ¶
type MCPConfig struct {
ConfigPath string `json:"-"`
MCPServers map[string]ServerConfigWrapper `json:"mcpServers"`
}
MCPConfig represents the configuration for MCP servers
func LoadMCPConfig ¶
LoadMCPConfig loads the MCP configuration from the specified path or default location
type MCPHost ¶
type MCPHost struct {
// contains filtered or unexported fields
}
MCPHost manages MCP server connections and tools
func NewMCPHost ¶
NewMCPHost creates a new MCPHost instance
func (*MCPHost) CloseServers ¶
CloseServers closes all connected MCP servers
func (*MCPHost) ConvertToolsToRecords ¶
func (host *MCPHost) ConvertToolsToRecords(tools []MCPTools) []MCPToolRecord
ConvertToolsToRecords converts []MCPTools to a list of database records
func (*MCPHost) ExportToolsToJSON ¶
ExportToolsToJSON dumps MCP tools to JSON file
func (*MCPHost) GetAllClients ¶
GetAllClients returns all MCP clients
func (*MCPHost) GetEinoTool ¶
func (h *MCPHost) GetEinoTool(ctx context.Context, serverName, toolName string) (tool.BaseTool, error)
GetEinoTool returns an eino tool for the given server and tool name
func (*MCPHost) GetEinoToolInfos ¶
GetEinoToolInfos convert MCP tools to eino tool infos
func (*MCPHost) InitServers ¶
InitServers initializes all MCP servers
func (*MCPHost) InvokeTool ¶
func (h *MCPHost) InvokeTool(ctx context.Context, serverName, toolName string, arguments map[string]any, ) (*mcp.CallToolResult, error)
InvokeTool calls a tool with the given arguments
type MCPToolRecord ¶
type MCPToolRecord struct {
ToolID string `json:"tool_id"` // Unique identifier for the tool record
BizID string `json:"biz_id"` // Business ID of the tool
VisibleRange int `json:"visible_range"` // Visible range of the tool, 0: visible to biz, 1: visible to all
ToolType string `json:"tool_type"` // Type of the tool
ServerName string `json:"mcp_server"` // Name of the MCP server
ToolName string `json:"tool_name"` // Name of the tool
Description string `json:"description"` // Tool description
Parameters string `json:"parameters"` // Tool input parameters in JSON format
Returns string `json:"return_desc"` // Tool return value format in JSON format
TeardownPair string `json:"teardown_pair"` // Teardown pair of the tool
Examples string `json:"examples"` // Examples of the tool
SupportPatterns string `json:"support_patterns"` // Support pattern of the tool
CreatedAt time.Time `json:"created_at"` // Record creation time
LastUpdatedAt time.Time `json:"last_updated_at"` // Record last update time
}
MCPToolRecord represents a single tool record in the database Each record contains detailed information about a tool and its server
type SSEServerConfig ¶
type SSEServerConfig struct {
Url string `json:"url"`
Headers []string `json:"headers,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
SSEServerConfig represents configuration for an SSE-based server
func (SSEServerConfig) GetType ¶
func (s SSEServerConfig) GetType() string
func (SSEServerConfig) IsDisabled ¶
func (s SSEServerConfig) IsDisabled() bool
type STDIOServerConfig ¶
type STDIOServerConfig struct {
Command string `json:"command"`
Args []string `json:"args"`
Env map[string]string `json:"env,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
STDIOServerConfig represents configuration for a STDIO-based server
func (STDIOServerConfig) GetType ¶
func (s STDIOServerConfig) GetType() string
func (STDIOServerConfig) IsDisabled ¶
func (s STDIOServerConfig) IsDisabled() bool
type ServerConfig ¶
ServerConfig is an interface for different types of server configurations
type ServerConfigWrapper ¶
type ServerConfigWrapper struct {
Config ServerConfig
}
ServerConfigWrapper is a wrapper for different types of server configurations
func (ServerConfigWrapper) MarshalJSON ¶
func (w ServerConfigWrapper) MarshalJSON() ([]byte, error)
func (*ServerConfigWrapper) UnmarshalJSON ¶
func (w *ServerConfigWrapper) UnmarshalJSON(data []byte) error