mcp

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolVersion = "2024-11-05"

ProtocolVersion is the MCP protocol version reported by SetupMCP.

Variables

This section is empty.

Functions

This section is empty.

Types

type InitializeResult

type InitializeResult struct {
	ProtocolVersion string         `json:"protocolVersion"`
	ServerInfo      ServerInfo     `json:"serverInfo"`
	Capabilities    map[string]any `json:"capabilities"`
}

InitializeResult is returned from the initialize request.

type Options

type Options struct {
	FlagName    string   // Name of the persistent flag (defaults to "mcp")
	Name        string   // Server name reported during initialize (defaults to root command name)
	Version     string   // Server version reported during initialize (defaults to structcli.Version)
	Separator   string   // Tool name separator for nested commands (defaults to "-")
	AllCommands bool     // Include runnable parent/root commands. By default MCP exposes runnable leaves only.
	Exclude     []string // Exclude tool names or full command paths from tools/list and tools/call
}

Options configures the --mcp flag for command-line applications.

type Request

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	ID      json.RawMessage `json:"id,omitempty"`
	Params  json.RawMessage `json:"params,omitempty"`
}

Request is a JSON-RPC request sent over MCP stdio.

type Response

type Response struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id,omitempty"`
	Result  any             `json:"result,omitempty"`
	Error   *ResponseError  `json:"error,omitempty"`
}

Response is a JSON-RPC response sent over MCP stdio.

type ResponseError

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ResponseError is a JSON-RPC error object.

type ServerInfo

type ServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

ServerInfo describes the MCP server.

type Tool

type Tool struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	InputSchema json.RawMessage `json:"inputSchema"`
}

Tool is exposed by tools/list.

type ToolCallContent

type ToolCallContent struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

ToolCallContent is a single text content part in a tools/call result.

type ToolCallParams

type ToolCallParams struct {
	Name      string         `json:"name"`
	Arguments map[string]any `json:"arguments,omitempty"`
}

ToolCallParams are provided to tools/call.

type ToolCallResult

type ToolCallResult struct {
	Content []ToolCallContent `json:"content"`
	IsError bool              `json:"isError,omitempty"`
}

ToolCallResult is returned from tools/call.

type ToolsListResult

type ToolsListResult struct {
	Tools []Tool `json:"tools"`
}

ToolsListResult is returned from tools/list.

Jump to

Keyboard shortcuts

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