Skip to main content

mcp_tool

Attribute Macro mcp_tool 

Source
#[mcp_tool]
Expand description

Marks a function as an MCP tool.

MCP tools are explicitly opt-in and exposed through the MCP endpoint.

ยงAttributes

  • name = "tool_name" - Override the exposed tool name
  • title = "Human title" - Display title for MCP clients
  • description = "..." - Tool description
  • public - No authentication required
  • require_role("admin") - Require specific role
  • timeout = 30 - Timeout in seconds
  • rate_limit(requests = 100, per = "1m", key = "user")
  • read_only - Annotation hint for clients
  • destructive - Annotation hint for clients
  • idempotent - Annotation hint for clients
  • open_world - Annotation hint for clients
  • Parameter #[schemars(...)] / #[serde(...)] attrs - Included in generated input schema