rust-mcp-macros.
A procedural macro, part of the rust-mcp-sdk ecosystem, to generate rust_mcp_schema::Tool
instance from a struct.
The mcp_tool
macro generates an implementation for the annotated struct that includes:
- A
tool_name()
method returning the tool's name as a string. - A
tool()
method returning arust_mcp_schema::Tool
instance with the tool's name, description, and input schema derived from the struct's fields.
Attributes
name
- The name of the tool (required, non-empty string).description
- A description of the tool (required, non-empty string).
Usage Example
Check out rust-mcp-sdk , a high-performance, asynchronous toolkit for building MCP servers and clients. Focus on your app's logic while rust-mcp-sdk takes care of the rest!
Note: The following attributes are available only in version 2025_03_26
and later of the MCP Schema, and their values will be used in the annotations attribute of the *Tool struct.
destructive_hint
idempotent_hint
open_world_hint
read_only_hint