Documentation
¶
Overview ¶
Package mcpannotations derives MCP tool annotations (readOnlyHint, destructiveHint, ...) for an OpenAPI operation: from its HTTP method, overridden by x-mcp-* extensions on the operation. The proxy uses them on the tool MCP endpoint; the app guardrail capability suggestion uses them to tell read-only tools from acting ones.
Index ¶
Constants ¶
const ( ExtReadOnlyHint = "x-mcp-read-only" ExtDestructiveHint = "x-mcp-destructive" ExtIdempotentHint = "x-mcp-idempotent" ExtOpenWorldHint = "x-mcp-open-world" )
MCP annotation overrides an author can set on an OpenAPI operation. The HTTP method is only ever an approximation of what an operation does - a POST that runs a search is not destructive, and a GET that mints a resource is - so a spec can say so directly.
Variables ¶
This section is empty.
Functions ¶
func ApplyOverrides ¶
func ApplyOverrides(annotation mcp.ToolAnnotation, extensions map[string]string) mcp.ToolAnnotation
ApplyOverrides lets the OpenAPI document override any hint the HTTP method implied. A non-boolean value is ignored rather than guessed at.
func ForMethod ¶
func ForMethod(method string) mcp.ToolAnnotation
ForMethod derives MCP tool annotations from an operation's HTTP method. Without this every operation inherited mcp.NewTool's conservative defaults - readOnly false, destructive true - so a read-only GET was rendered with a red DESTRUCTIVE badge, and clients that gate on destructiveHint treated every tool as dangerous, devaluing the hint where it matters.
func ForOperation ¶
func ForOperation(client *universalclient.Client, operationID string) mcp.ToolAnnotation
Types ¶
This section is empty.