Documentation
¶
Overview ¶
Package mcp implements a minimal Model Context Protocol server: JSON-RPC 2.0 framed as one message per line over stdio. It knows nothing about Envault — callers register Tools whose handlers do the real work.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ObjectSchema ¶
func ObjectSchema(properties map[string]Property, required []string) json.RawMessage
ObjectSchema builds a JSON Schema object (type: "object") from the given properties and required field names. Passing nil properties yields a schema for a tool that takes no arguments.
Types ¶
type Property ¶
type Property struct {
Type string // "string", "array", ...
Items string // element type, only used when Type == "array"
Description string
}
Property describes one field of a tool's input JSON Schema.
type Server ¶
Server dispatches JSON-RPC requests read from stdio to registered Tools.
func (*Server) PrintSchemas ¶
PrintSchemas writes the JSON Schema of every registered tool to w, pretty printed as a single JSON array. Used by `envault mcp serve --dry-run` for debugging and for generating the plugin manifest's tool documentation.
type Tool ¶
type Tool struct {
Name string
Description string
InputSchema json.RawMessage
Handler func(arguments json.RawMessage) (interface{}, error)
}
Tool is a single MCP tool: its JSON Schema contract and the function that executes it. Handler receives the raw "arguments" object from the tools/call request and returns a JSON-serializable result or an error.