agentleFS
snowmeadsnowmead/rust-docs-mcp/CLAUDE.md

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
  1. Distinctive:

    When testing the rust-docs MCP server, call the tools from the rust-docs-testing MCP.

    line 1
  2. Distinctive:

    Must be used on the service struct's implementation

    line 9
  3. Very specific:

    Must implement get_info() returning ServerInfo

    line 18
  4. Very specific:

    Always destructure with Parameters(params) pattern

    line 27

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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

  1. #[tool_router] - Applied to impl blocks to generate tool routing
    • Automatically creates a tool_router() method returning ToolRouter<Self>
    • Must be used on the service struct's implementation
  2. #[tool] - Marks individual methods as MCP tools
    • Required parameter: description = "tool description"
    • Methods must be pub async fn
    • Can return any serializable type
  3. #[tool_handler] - Applied to ServerHandler trait implementation
    • Required for the service to work with serve_server()
    • Must implement get_info() returning ServerInfo

Parameter Handling

  1. Parameters<T> Wrapper - Required for ALL tool parameters
    pub async fn my_tool(&self, Parameters(params): Parameters<MyParams>) -> String
    • Type T must implement JsonSchema, Deserialize, Serialize
    • Always destructure with Parameters(params) pattern

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
        }
    }
}

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.