rust-docs-mcp
CLAUDE.md135 starsChanged 16 months agoMITView on GitHub
When testing the rust-docs MCP server, call the tools from the rust-docs-testing MCP. Note: Parameters must be imported from handler::server::tool::Parameters, not directly from rmcp.
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 1
When testing the rust-docs MCP server, call the tools from the rust-docs-testing MCP.
- Distinctive: line 9
Must be used on the service struct's implementation
- Very specific: line 18
Must implement get_info() returning ServerInfo
- Very specific: line 27
Always destructure with Parameters(params) pattern
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When testing the rust-docs MCP server, call the tools from the rust-docs-testing MCP.
MCP Rust SDK Macros
Core Macros for Tool Declaration
#[tool_router]- Applied to impl blocks to generate tool routing- Automatically creates a
tool_router()method returningToolRouter<Self> - Must be used on the service struct's implementation
- Automatically creates a
#[tool]- Marks individual methods as MCP tools- Required parameter:
description = "tool description" - Methods must be
pub async fn - Can return any serializable type
- Required parameter:
#[tool_handler]- Applied toServerHandlertrait implementation- Required for the service to work with
serve_server() - Must implement
get_info()returningServerInfo
- Required for the service to work with
Parameter Handling
Parameters<T>Wrapper - Required for ALL tool parameterspub async fn my_tool(&self, Parameters(params): Parameters<MyParams>) -> String- Type
Tmust implementJsonSchema,Deserialize,Serialize - Always destructure with
Parameters(params)pattern
- Type
Required Imports
use rmcp::{
ServerHandler,
handler::server::{router::tool::ToolRouter, tool::Parameters},
model::{ServerCapabilities, ServerInfo},
tool, tool_handler, tool_router,
};Note: Parameters must be imported from handler::server::tool::Parameters, not directly from rmcp.
Complete Service Pattern
use rmcp::{
ServerHandler,
handler::server::{router::tool::ToolRouter, tool::Parameters},
model::{ServerCapabilities, ServerInfo},
tool, tool_handler, tool_router,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct MyParams {
#[schemars(description = "Parameter description")]
pub param_name: String,
}
#[derive(Debug, Clone)]
pub struct MyService {
tool_router: ToolRouter<Self>,
// other fields
}
#[tool_router]
impl MyService {
pub fn new() -> Self {
Self {
tool_router: Self::tool_router(), // Generated by macro
// other fields
}
}
#[tool(description = "Does something useful")]
pub async fn my_tool(&self, Parameters(params): Parameters<MyParams>) -> String {
// Implementation using params.param_name
format!("Processed: {}", params.param_name)
}
}
#[tool_handler]
impl ServerHandler for MyService {
fn get_info(&self) -> ServerInfo {
ServerInfo {
capabilities: ServerCapabilities::builder().enable_tools().build(),
// other config
}
}
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

