Documentation
¶
Index ¶
- type Client
- func (c *Client) CallTool(ctx context.Context, name string, arguments map[string]interface{}) (*MCPResponse, error)
- func (c *Client) ListResources(ctx context.Context) (*MCPResponse, error)
- func (c *Client) ListTools(ctx context.Context) (*MCPResponse, error)
- func (c *Client) ReadResource(ctx context.Context, uri string) (*MCPResponse, error)
- func (c *Client) SendMCPRequest(ctx context.Context, req *MCPRequest) (*MCPResponse, error)
- type MCPError
- type MCPRequest
- type MCPResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client MCP API客户端 (Model Context Protocol)
func (*Client) CallTool ¶
func (c *Client) CallTool(ctx context.Context, name string, arguments map[string]interface{}) (*MCPResponse, error)
CallTool 调用工具
func (*Client) ListResources ¶
func (c *Client) ListResources(ctx context.Context) (*MCPResponse, error)
ListResources 列出可用资源
func (*Client) ListTools ¶
func (c *Client) ListTools(ctx context.Context) (*MCPResponse, error)
ListTools 列出可用工具
func (*Client) ReadResource ¶
ReadResource 读取资源
func (*Client) SendMCPRequest ¶
func (c *Client) SendMCPRequest(ctx context.Context, req *MCPRequest) (*MCPResponse, error)
SendMCPRequest 发送MCP请求
type MCPError ¶
type MCPError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
MCPError MCP错误
type MCPRequest ¶
type MCPRequest struct {
Method string `json:"method"`
Params map[string]interface{} `json:"params,omitempty"`
}
MCPRequest MCP请求
type MCPResponse ¶
type MCPResponse struct {
ID string `json:"id,omitempty"`
Result map[string]interface{} `json:"result,omitempty"`
Error *MCPError `json:"error,omitempty"`
}
MCPResponse MCP响应
Click to show internal directories.
Click to hide internal directories.