Documentation
¶
Overview ¶
Package mcptest provides shared test doubles for the mcp package's interfaces.
Index ¶
- type FakeRegistry
- func (f FakeRegistry) CallTool(_ context.Context, name string, _ json.RawMessage) (mcp.RawToolResult, error)
- func (FakeRegistry) Instructions(context.Context) (string, error)
- func (f FakeRegistry) ListResources(context.Context, string) (mcp.ResourcesListResult, error)
- func (f FakeRegistry) ReadResource(_ context.Context, uri string) (mcp.ResourcesReadResult, error)
- func (FakeRegistry) Resources(context.Context) iter.Seq2[mcp.ResourceDescriptor, error]
- func (FakeRegistry) SubscribeResourceUpdates(context.Context, mcp.SubscriptionFilter) (iter.Seq2[mcp.ResourceUpdate, error], error)
- func (FakeRegistry) Tools(context.Context) ([]mcp.ToolDescriptor, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeRegistry ¶
type FakeRegistry struct {
CallErr error
CallResult *mcp.RawToolResult
ListErr error
ReadErr error
}
FakeRegistry is a minimal mcp.Registry: it advertises one "echo" tool and one "caic://tasks" resource, enough to exercise protocol envelopes. Set CallErr, CallResult, ListErr, or ReadErr to customize a tool or resource response.
func (FakeRegistry) CallTool ¶
func (f FakeRegistry) CallTool(_ context.Context, name string, _ json.RawMessage) (mcp.RawToolResult, error)
CallTool implements mcp.Registry.
func (FakeRegistry) Instructions ¶
func (FakeRegistry) Instructions(context.Context) (string, error)
Instructions implements mcp.Registry.
func (FakeRegistry) ListResources ¶
func (f FakeRegistry) ListResources(context.Context, string) (mcp.ResourcesListResult, error)
ListResources implements mcp.Registry.
func (FakeRegistry) ReadResource ¶
func (f FakeRegistry) ReadResource(_ context.Context, uri string) (mcp.ResourcesReadResult, error)
ReadResource implements mcp.Registry.
func (FakeRegistry) Resources ¶
func (FakeRegistry) Resources(context.Context) iter.Seq2[mcp.ResourceDescriptor, error]
Resources implements mcp.Registry.
func (FakeRegistry) SubscribeResourceUpdates ¶
func (FakeRegistry) SubscribeResourceUpdates(context.Context, mcp.SubscriptionFilter) (iter.Seq2[mcp.ResourceUpdate, error], error)
SubscribeResourceUpdates implements mcp.SubscriptionRegistry.
func (FakeRegistry) Tools ¶
func (FakeRegistry) Tools(context.Context) ([]mcp.ToolDescriptor, error)
Tools implements mcp.Registry.
Click to show internal directories.
Click to hide internal directories.