impl_mcp_tool

Macro impl_mcp_tool 

Source
macro_rules! impl_mcp_tool {
    (
        name = $tool_name:expr,
        description = $tool_desc:expr,
        struct $struct_name:ident {
            $(
                $field:ident: $field_type:ty {
                    description = $field_desc:expr
                    $(, min_length = $min_len:expr)?
                }
            ),* $(,)?
        }
    ) => { ... };
}
Expand description

The macro generates:

  • impl McpToolDefinition for StructName
  • tool_definition() method returning rust_mcp_sdk::schema::Tool
  • from_mcp_params() method with parameter conversion and validation