client

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package client implements mcp client functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCommandString

func ParseCommandString(cmdStr string) []string

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

func NewHTTP(address string) *Client

NewHTTP creates a MCP client that communicates with a server via HTTP using JSON-RPC.

func NewStdio

func NewStdio(command []string) *Client

NewStdio creates a new MCP client that communicates with a command via stdin/stdout using JSON-RPC.

func NewWithTransport

func NewWithTransport(t transport.Transport) *Client

NewWithTransport creates a new MCP client using the provided transport. This allows callers to provide a custom transport implementation.

func (*Client) CallTool

func (c *Client) CallTool(toolName string, args map[string]any) (map[string]any, error)

CallTool calls a specific tool on the MCP server with the given arguments.

func (*Client) GetPrompt

func (c *Client) GetPrompt(promptName string) (map[string]any, error)

GetPrompt retrieves a specific prompt from the MCP server.

func (*Client) ListPrompts

func (c *Client) ListPrompts() (map[string]any, error)

ListPrompts retrieves the list of available prompts from the MCP server.

func (*Client) ListResources

func (c *Client) ListResources() (map[string]any, error)

ListResources retrieves the list of available resources from the MCP server.

func (*Client) ListTools

func (c *Client) ListTools() (map[string]any, error)

ListTools retrieves the list of available tools from the MCP server.

func (*Client) ReadResource

func (c *Client) ReadResource(uri string) (map[string]any, error)

ReadResource reads the content of a specific resource from the MCP server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL