Documentation
¶
Overview ¶
Package api serves an operation registry over HTTP:
GET /ops the registry metadata (toolkit.metadata.v1)
POST /ops/{name} run one operation with a JSON input
GET /openapi.json an OpenAPI 3.1 document of the routes
Every operation is a POST so structured input keeps its body; the effect, not the HTTP verb, says whether it changes state. A success returns the operation output as the body. A failure returns {"error": {code, message, suggestions}} with the status of the error kind.
Index ¶
Constants ¶
const MaxBodyBytes = 1 << 20
MaxBodyBytes bounds a request body.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler returns the HTTP handler for reg. Mount MCP at /mcp next to it if the tool serves MCP over HTTP.
func OpenAPI ¶
OpenAPI returns the OpenAPI 3.1 document for reg. Request and response schemas are the registry's own JSON Schemas, inlined, so the document and the metadata cannot drift. Each operation's id is its MCP name, and its effect is in the x-effect extension.
func WriteError ¶
func WriteError(w http.ResponseWriter, err error)
WriteError writes err as an ErrorBody with the status of its kind.
Types ¶
type Options ¶
type Options struct {
// Authorizer decides whether a caller may run an operation. Nil means
// op.DenyWrites: reads and previews are allowed, applied writes are not.
Authorizer op.Authorizer
}
Options configures the HTTP surface.