#[mcp_tool]Available on crate feature
macros only.Expand description
Marks a method as an MCP tool.
Note: This is an inert marker attribute that should only be used within
impl blocks marked with #[mcp_server]. When used outside of #[mcp_server],
it will generate tool metadata but won’t be collected into a server.
§Example
ⓘ
#[mcp_server]
impl MyServer {
#[mcp_tool(description = "Store a value in memory")]
pub fn memory_write(
&self,
#[mcp(description = "The scope/namespace")]
scope: String,
#[mcp(description = "The key to store under")]
key: String,
) -> Result<String, String> {
// implementation
}
}