Documentation
¶
Overview ¶
Package tools turns the operations of an OpenAPI document into MCP tool definitions: one operation becomes one tool. It records, for each tool argument, where it goes in the HTTP request, so a handler can rebuild the call later. The rules are in docs/SPEC.md, section 3.
Index ¶
Constants ¶
const LookupKeyArg = "idempotency_key"
LookupKeyArg is the argument of a lookup tool that takes the Idempotency-Key to search for.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arg ¶
type Arg struct {
In Location
Name string // the name in the request: the parameter or body field name
}
Arg binds one tool argument to its place in the HTTP request.
type Tool ¶
type Tool struct {
Def *mcp.Tool
Method string // upper case, e.g. "POST"
Path string // the path template, e.g. "/charges/{charge_id}"
Args map[string]Arg
// Input is the resolved input schema, used to validate arguments before
// any request is sent.
Input *jsonschema.Resolved
// Sensitive holds the names of fields whose values must never be
// written to the audit log: those marked "format: password" or
// "x-writgate-sensitive: true" anywhere in the request or response.
Sensitive map[string]bool
// Lookup is the read-only tool that finds this call's result by
// Idempotency-Key when it is unknown, from "x-writgate-lookup". It is
// called with the arguments the two tools share plus LookupKeyArg.
// Empty when the operation names none.
Lookup string
}
Tool is one operation served as an MCP tool.
func Build ¶
Build maps every operation in doc to a tool. An operation writgate can't serve is skipped with a warning; a conflict that would make tool names ambiguous is an error.
func (*Tool) Destructive ¶
Destructive reports whether the tool is in the policy group "destructive".