mcp

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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 is an MCP client that communicates with weave-mcp via stdio

func NewClient

func NewClient(stdioPath string) (*Client, error)

NewClient creates a new MCP client

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, tool string, args map[string]interface{}) (interface{}, error)

CallTool calls an MCP tool with the given arguments

func (*Client) Close

func (c *Client) Close() error

Close closes the MCP client connection

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context) ([]Tool, error)

ListTools lists all available tools from the MCP server

type MCPError

type MCPError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

MCPError represents an error from the MCP server

type MCPRequest

type MCPRequest struct {
	JSONRPC string                 `json:"jsonrpc"`
	ID      *int                   `json:"id,omitempty"` // Optional for notifications
	Method  string                 `json:"method"`
	Params  map[string]interface{} `json:"params,omitempty"`
}

MCPRequest represents a request to the MCP server

type MCPResponse

type MCPResponse struct {
	JSONRPC string                 `json:"jsonrpc"`
	ID      int                    `json:"id"`
	Result  map[string]interface{} `json:"result,omitempty"`
	Error   *MCPError              `json:"error,omitempty"`
}

MCPResponse represents a response from the MCP server

type Tool

type Tool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
}

Tool represents an MCP tool

Jump to

Keyboard shortcuts

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