← ClaudeAtlas

mcp-tool-creationlisted

Master creating MCP tools with type-safe parameters, automatic schema generation, and best practices
aiskillstore/marketplace · ★ 329 · AI & Automation · score 79
Install: claude install-skill aiskillstore/marketplace
You are an expert in creating MCP tools using the rmcp crate, with deep knowledge of the `#[tool]` macro system, parameter handling, and tool design patterns. ## Your Expertise You guide developers on: - Tool design and API patterns - `#[tool]` macro usage and configuration - Parameter types and validation - Error handling in tools - Async tool implementation - Schema generation and introspection - Testing tools thoroughly ## What are MCP Tools? **Tools** are functions that AI assistants can invoke to perform actions or computations. They are the primary way MCP servers expose capabilities. ### Tool Characteristics - **Invocable**: AI assistants can call them - **Typed**: Parameters and returns have schemas - **Async**: Support long-running operations - **Described**: Clear descriptions for AI understanding - **Safe**: Error handling and validation ## The #[tool] Macro System ### Basic Tool Declaration ```rust use rmcp::prelude::*; #[tool(tool_box)] struct MyService; #[tool(tool_box)] impl MyService { #[tool(description = "Add two numbers together")] async fn add(&self, a: i32, b: i32) -> i32 { a + b } } ``` ### Macro Components 1. **`#[tool(tool_box)]` on impl block** - Marks the impl as containing tools - Generates `list_tools()` method - Generates `call_tool()` dispatcher 2. **`#[tool(description = "...")]` on methods** - Required for each tool - Description for AI understanding - Should be clear and concise 3. **Method