What problem does it solve?
Extending an MCP server with new tools requires careful adherence to protocol, stdio safety, and robust error handling to prevent system instability and communication corruption. This Skill provides a systematic approach to safely add new tools to the AI Counsel server.
Core Features & Use Cases
- Pydantic Request/Response Models: Define type-safe models for tool inputs and outputs, ensuring strict validation and clear documentation.
- Stdio Safety: Learn critical rules to prevent stdout contamination, ensuring the MCP server's communication channel remains intact.
- Graceful Error Handling: Implement structured error responses for validation failures and runtime exceptions, preventing server crashes.
- Tool Definition & Routing: Guide for adding new tool definitions to
list_tools() and routing calls in call_tool() within server.py.
- Use Case: You need to expose a new internal API (e.g., a custom data retrieval service) as an MCP tool. This skill guides you through defining its schema, implementing its async handler, and integrating it into the server, allowing AI models to leverage this new capability during deliberations without risking server stability.
Quick Start
Begin by defining Pydantic models for your new tool's request and response in models/schema.py:
In models/schema.py
class NewToolRequest(BaseModel):
parameter1: str = Field(..., description="Description of parameter1")
class NewToolResponse(BaseModel):
status: Literal["success"]
result_data: str