Documentation
¶
Index ¶
- func PrintTestResults(results []TestResult)
- type Client
- func (c *Client) CallTool(ctx context.Context, toolName string, args map[string]any) (string, error)
- func (c *Client) Close() error
- func (c *Client) Initialize(ctx context.Context) error
- func (c *Client) ListTools(ctx context.Context) ([]Tool, error)
- func (c *Client) Name() string
- func (c *Client) Stderr() string
- type Manager
- type TestResult
- type Tool
- type ToolContent
- type ToolParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintTestResults ¶
func PrintTestResults(results []TestResult)
PrintTestResults prints formatted test results to stdout.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with one MCP server process over stdio (JSON-RPC 2.0).
func NewClient ¶
func NewClient(ctx context.Context, name, command string, args []string, env map[string]string) (*Client, error)
NewClient spawns an MCP server subprocess and returns a connected client.
func (*Client) CallTool ¶
func (c *Client) CallTool(ctx context.Context, toolName string, args map[string]any) (string, error)
CallTool invokes a tool and returns the text result.
func (*Client) Initialize ¶
Initialize performs the MCP handshake (initialize + notifications/initialized).
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the lifecycle of multiple MCP server connections and registers their tools into catpaw's ToolRegistry.
func (*Manager) IdentitySummary ¶
IdentitySummary returns a prompt-friendly summary of all MCP server identities.
func (*Manager) ServerCount ¶
ServerCount returns the number of connected servers.
func (*Manager) ServerNames ¶
ServerNames returns sorted names of all connected servers.
func (*Manager) StartAll ¶
func (m *Manager) StartAll(ctx context.Context, mcpCfg config.MCPConfig, registry *diagnose.ToolRegistry)
StartAll connects to all configured MCP servers, discovers their tools, and registers them into the ToolRegistry. Servers that fail to start are logged and skipped (best-effort).
type TestResult ¶
type TestResult struct {
Name string
Status string // PASS, FAIL
Identity string
Tools []string
Allowed []string
Message string
Elapsed time.Duration
}
TestResult holds the result of testing one MCP server.
func RunTest ¶
func RunTest(mcpCfg config.MCPConfig) []TestResult
RunTest connects to each configured MCP server, performs the handshake, discovers tools, and returns structured results. Each server is tested independently; failures are isolated.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema json.RawMessage `json:"inputSchema,omitempty"`
}
Tool describes one tool exposed by an MCP server.
func (*Tool) ExtractParams ¶
ExtractParams parses the inputSchema JSON Schema into a flat list of ToolParams.
type ToolContent ¶
ToolContent represents one content block in a tool call response.