Documentation
¶
Index ¶
- type CallRecord
- type MockServer
- func (ms *MockServer) ClearCallHistory()
- func (ms *MockServer) GetCallCount(toolName string) int
- func (ms *MockServer) GetCallHistory() []CallRecord
- func (ms *MockServer) SimulateDisconnect()
- func (ms *MockServer) SimulateReconnect()
- func (ms *MockServer) Start(ctx context.Context, transport mcp.Transport) error
- type MockServerConfig
- type MockTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallRecord ¶
CallRecord tracks a tool call
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
MockServer implements a mock MCP server for testing
func NewMockServer ¶
func NewMockServer(config MockServerConfig) *MockServer
NewMockServer creates a new mock MCP server
func (*MockServer) ClearCallHistory ¶
func (ms *MockServer) ClearCallHistory()
ClearCallHistory clears the call history
func (*MockServer) GetCallCount ¶
func (ms *MockServer) GetCallCount(toolName string) int
GetCallCount returns the number of calls to a specific tool
func (*MockServer) GetCallHistory ¶
func (ms *MockServer) GetCallHistory() []CallRecord
GetCallHistory returns the call history
func (*MockServer) SimulateDisconnect ¶
func (ms *MockServer) SimulateDisconnect()
SimulateDisconnect simulates server disconnection
func (*MockServer) SimulateReconnect ¶
func (ms *MockServer) SimulateReconnect()
SimulateReconnect simulates server reconnection
type MockServerConfig ¶
type MockServerConfig struct {
ServerName string
Version string
Tools []MockTool
SimulateDelay time.Duration
FailOnCall bool
}
MockServerConfig holds configuration for a mock server
type MockTool ¶
type MockTool struct {
Name string
Description string
InputSchema map[string]any
Handler func(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)
}
MockTool represents a configurable mock tool
func CreateCalculatorTool ¶
func CreateCalculatorTool() MockTool
CreateCalculatorTool creates a tool that performs simple calculations
func CreateDelayTool ¶
CreateDelayTool creates a tool that responds after a delay
func CreateEchoTool ¶
CreateEchoTool creates a simple echo tool that returns its input
func CreateToolWithDotsInName ¶
func CreateToolWithDotsInName() MockTool
CreateToolWithDotsInName creates a tool with dots in its name