Documentation
¶
Overview ¶
Package registry collects MCP tool registrations as plain descriptors and binds them to a server in one pass, so the catalogue can be enumerated and filtered without a live server. Write tools are gated behind Enable.Write.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Access ¶
type Access int
Access classifies a tool as read-only or state-mutating; Bind gates AccessWrite tools behind Enable.Write.
type Enable ¶
type Enable struct {
Write bool
}
Enable selects which registrations Bind installs; Write gates AccessWrite tools.
type Option ¶
type Option[In any] func(*options[In])
Option configures a Read/Write registration. In is inferred from the option argument (and pinned by the call func), so it is rarely written explicitly.
func WithElicitFunc ¶
func WithElicitFunc[In any](f toolkit.ElicitParamsFunc[In]) Option[In]
WithElicitFunc sets a write tool's elicitation-prompt builder. Passing it to a Read registration panics at Bind time (enforced by toolkit.AddRead).
func WithOutputSchema ¶
func WithOutputSchema[In any](s *jsonschema.Schema) Option[In]
WithOutputSchema sets the tool's optional output schema. When it's the only option, In can't be inferred from the schema; pass it explicitly (WithOutputSchema[YourIn](schema)).
func WithValidateFunc ¶
func WithValidateFunc[In any](f toolkit.ValidateFunc[In]) Option[In]
WithValidateFunc sets a validator run on decoded input before the call.
type Registration ¶
Registration is a server-independent description of one tool. bind captures the toolkit.New(...).AddRead/AddWrite call, deferring the *mcp.Server to Bind.
func Read ¶
func Read[In, Out any]( name, description string, in *jsonschema.Schema, call toolkit.CallFunc[In, Out], opts ...Option[In], ) Registration
Read describes a read-only tool. In/Out are inferred from call.
func Write ¶
func Write[In, Out any]( name, description string, in *jsonschema.Schema, call toolkit.CallFunc[In, Out], opts ...Option[In], ) Registration
Write describes a state-mutating tool gated by elicitation. In/Out are inferred from call.
type Registry ¶
type Registry []Registration
Registry is an ordered, server-independent collection of registrations.
func New ¶
func New(groups ...[]Registration) Registry
New flattens tool-group slices into a Registry, preserving order.