Documentation
¶
Overview ¶
Package adapter wires the datasource service to the production tool dispatch path in internal/tool/registry. It is deliberately kept in its own package so that service/datasource stays free of runtime-package imports and remains trivially unit-testable with an in-memory ToolExecutor.
Typical wiring at process startup:
reg := registry.New(...)
dsSvc := datasource.New(datasource.Options{
Store: dsStore,
Executor: adapter.FromRegistry(reg),
})
The adapter preserves ctx end-to-end — auth propagates via protocol/mcp/manager.WithAuthTokenContext inside Registry.Execute, same as every other tool call.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ToolRegistry ¶
type ToolRegistry interface {
Execute(ctx context.Context, name string, args map[string]interface{}) (string, error)
}
ToolRegistry is the subset of *registry.Registry we depend on. Defining the interface here lets tests substitute a stub without pulling in the full runtime registry.
func FromRegistry ¶
func FromRegistry(reg ToolRegistry) ToolRegistry
FromRegistry wraps any ToolRegistry (typically *registry.Registry) so it satisfies datasource.ToolExecutor. Returns nil when reg is nil so callers can pass the result directly into datasource.Options.Executor — the datasource service rejects nil at Fetch time with a clear error.