Documentation
¶
Overview ¶
Package testutil provides shared test utilities for protomcp tests.
Index ¶
- func FixturePath(relPath string) string
- func RepoRoot() string
- func SetupPythonPath()
- type Capabilities
- type ContentItem
- type InitializeResult
- type JSONRPCError
- type JSONRPCRequest
- type JSONRPCResponse
- type MCPTool
- type PMCPResult
- type ServerInfo
- type StdioPMCP
- type ToolsCallResult
- type ToolsCapability
- type ToolsListResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FixturePath ¶
FixturePath returns the absolute path to a fixture file relative to the repo root.
func RepoRoot ¶
func RepoRoot() string
RepoRoot returns the absolute path to the repository root by walking up from this source file.
func SetupPythonPath ¶
func SetupPythonPath()
SetupPythonPath configures PYTHONPATH so that the generated protobuf code is importable by Python fixture scripts.
Types ¶
type Capabilities ¶
type Capabilities struct {
Tools *ToolsCapability `json:"tools,omitempty"`
}
type ContentItem ¶
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities Capabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
}
type JSONRPCError ¶
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
JSONRPCError is a JSON-RPC 2.0 error object.
type JSONRPCRequest ¶
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
ID json.RawMessage `json:"id,omitempty"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
JSONRPCRequest is a minimal JSON-RPC 2.0 request.
type JSONRPCResponse ¶
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
ID json.RawMessage `json:"id,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
JSONRPCResponse is a minimal JSON-RPC 2.0 response.
type MCPTool ¶
type MCPTool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema json.RawMessage `json:"inputSchema"`
}
type PMCPResult ¶
type PMCPResult struct {
Resp JSONRPCResponse
Raw []byte
Latency time.Duration
}
PMCPResult holds a parsed JSON-RPC response plus the raw bytes and the round trip latency.
type ServerInfo ¶
type StdioPMCP ¶
type StdioPMCP struct {
Cmd *exec.Cmd
Stdin io.WriteCloser
Reader *bufio.Scanner
// contains filtered or unexported fields
}
StdioPMCP wraps a running pmcp process and provides helpers for sending JSON-RPC requests over its stdio transport.
func (*StdioPMCP) Initialize ¶
Initialize sends a proper MCP initialize handshake (initialize + initialized notification).
type ToolsCallResult ¶
type ToolsCallResult struct {
Content []ContentItem `json:"content"`
IsError bool `json:"isError,omitempty"`
}
type ToolsCapability ¶
type ToolsCapability struct {
ListChanged bool `json:"listChanged"`
}
type ToolsListResult ¶
type ToolsListResult struct {
Tools []MCPTool `json:"tools"`
}