mcpannotations

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL