Documentation
¶
Index ¶
- type CallResult
- type Engine
- func (e *Engine) CallTool(ctx context.Context, name string, args map[string]any) (*CallResult, error)
- func (e *Engine) GetPrompt(ctx context.Context, name string, args map[string]string) (*mcp.GetPromptResult, error)
- func (e *Engine) ListPrompts(ctx context.Context) ([]*mcp.Prompt, error)
- func (e *Engine) ListResources(ctx context.Context) ([]*mcp.Resource, error)
- func (e *Engine) ListTools(ctx context.Context) ([]*mcp.Tool, error)
- func (e *Engine) OnToolsChanged(fn func([]*mcp.Tool))
- func (e *Engine) ReadResource(ctx context.Context, uri string) (*mcp.ReadResourceResult, error)
- func (e *Engine) Reload(ctx context.Context) error
- func (e *Engine) Start(ctx context.Context) error
- func (e *Engine) Stop()
- func (e *Engine) Trace() *TraceLog
- type Option
- type TraceEntry
- type TraceLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallResult ¶
type CallResult struct {
Result *mcp.CallToolResult
Duration time.Duration
ToolsEnabled []string
ToolsDisabled []string
}
CallResult wraps the result of a tool call with additional metadata.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine wires together a process manager, bridge, and MCP client for testing tool processes.
func (*Engine) CallTool ¶
func (e *Engine) CallTool(ctx context.Context, name string, args map[string]any) (*CallResult, error)
CallTool calls a tool by name with the given arguments.
func (*Engine) GetPrompt ¶
func (e *Engine) GetPrompt(ctx context.Context, name string, args map[string]string) (*mcp.GetPromptResult, error)
GetPrompt gets a prompt by name with the given arguments.
func (*Engine) ListPrompts ¶
ListPrompts returns the prompts available from the server.
func (*Engine) ListResources ¶
ListResources returns the resources available from the server.
func (*Engine) OnToolsChanged ¶
OnToolsChanged registers a callback for tool list changes.
func (*Engine) ReadResource ¶
ReadResource reads a resource by URI.
type Option ¶
type Option func(*engineConfig)
Option configures the Engine.
func WithCallTimeout ¶
WithCallTimeout sets the timeout for tool calls.
func WithRuntime ¶
WithRuntime overrides the auto-detected runtime command.
type TraceEntry ¶
type TraceEntry struct {
Seq uint64 `json:"seq"`
Timestamp time.Time `json:"timestamp"`
Direction string `json:"direction"` // "send" or "recv"
Raw string `json:"raw"` // full JSON-RPC message
Method string `json:"method,omitempty"`
}
TraceEntry records a single JSON-RPC message.
type TraceLog ¶
type TraceLog struct {
// contains filtered or unexported fields
}
TraceLog provides thread-safe storage and pub/sub for protocol trace entries.
func (*TraceLog) Entries ¶
func (t *TraceLog) Entries() []TraceEntry
Entries returns a snapshot of all recorded entries.
func (*TraceLog) Subscribe ¶
func (t *TraceLog) Subscribe() chan TraceEntry
Subscribe returns a channel that receives new entries as they are recorded.
func (*TraceLog) Unsubscribe ¶
func (t *TraceLog) Unsubscribe(ch chan TraceEntry)
Unsubscribe removes a subscription channel.