Documentation
¶
Overview ¶
Package client implements mcp client functionality.
Index ¶
- func ParseCommandString(cmdStr string) []string
- type Client
- func (c *Client) CallTool(toolName string, args map[string]any) (map[string]any, error)
- func (c *Client) GetPrompt(promptName string) (map[string]any, error)
- func (c *Client) ListPrompts() (map[string]any, error)
- func (c *Client) ListResources() (map[string]any, error)
- func (c *Client) ListTools() (map[string]any, error)
- func (c *Client) ReadResource(uri string) (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCommandString ¶
ParseCommandString splits a command string into separate arguments, respecting spaces as argument separators. Note: This is a simple implementation that doesn't handle quotes or escapes.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides an interface to interact with MCP servers. It abstracts away the transport mechanism so callers don't need to worry about the details of HTTP, stdio, etc.
func NewHTTP ¶ added in v0.0.5
NewHTTP creates a MCP client that communicates with a server via HTTP using JSON-RPC.
func NewStdio ¶
NewStdio creates a new MCP client that communicates with a command via stdin/stdout using JSON-RPC.
func NewWithTransport ¶
NewWithTransport creates a new MCP client using the provided transport. This allows callers to provide a custom transport implementation.
func (*Client) CallTool ¶
CallTool calls a specific tool on the MCP server with the given arguments.
func (*Client) ListPrompts ¶
ListPrompts retrieves the list of available prompts from the MCP server.
func (*Client) ListResources ¶
ListResources retrieves the list of available resources from the MCP server.