rust-sdk/crates/rmcp-macros
github-actions[bot] ac749e3ced
chore: release v1.3.0 (#747)
* chore: release v2.0.0

* chore: version 1.3.0

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dale Seo <5466341+DaleSeo@users.noreply.github.com>
2026-03-26 11:31:13 -04:00
..
src feat: add local feature for !Send tool handler support (#740) 2026-03-11 17:22:56 -04:00
Cargo.toml feat: add local feature for !Send tool handler support (#740) 2026-03-11 17:22:56 -04:00
CHANGELOG.md chore: release v1.3.0 (#747) 2026-03-26 11:31:13 -04:00
README.md feat: docs update (#718) 2026-03-03 11:14:30 -05:00

rmcp-macros

Crates.io Documentation

Procedural macros for the RMCP SDK. Most users should depend on rmcp with the macros feature (enabled by default) rather than using this crate directly.

For getting started and full MCP feature documentation, see the main README.

Available Macros

Macro Description
#[tool] Mark a function as an MCP tool handler
#[tool_router] Generate a tool router from an impl block
#[tool_handler] Generate call_tool and list_tools handler methods
#[prompt] Mark a function as an MCP prompt handler
#[prompt_router] Generate a prompt router from an impl block
#[prompt_handler] Generate get_prompt and list_prompts handler methods
#[task_handler] Wire up the task lifecycle on top of an OperationProcessor

Quick Example

use rmcp::{tool, tool_router, tool_handler, ServerHandler, model::*};

#[derive(Clone)]
struct MyServer {
    tool_router: rmcp::handler::server::tool::ToolRouter<Self>,
}

#[tool_router]
impl MyServer {
    #[tool(description = "Say hello")]
    async fn hello(&self) -> String {
        "Hello, world!".into()
    }
}

#[tool_handler]
impl ServerHandler for MyServer {
    fn get_info(&self) -> ServerInfo {
        ServerInfo::default()
    }
}

See the full documentation for detailed usage of each macro.

License

This project is licensed under the terms specified in the repository's LICENSE file.