This skill should be used when the user asks to "design MCP tool", "create tool schema", "tool best practices", "input validation", "output schema", "error handling for tools", or discusses designing individual MCP tools with proper schemas and responses.
From mcp-architectnpx claudepluginhub standardbeagle/standardbeagle-tools --plugin mcp-architectThis skill uses the workspace's default tool permissions.
Design individual MCP tools with clear input/output schemas, proper error handling, and token-efficient responses following best practices.
{
"name": "search",
"input": {
"pattern": {
"type": "string",
"required": true,
"description": "Search pattern (regex supported)"
},
"filter": {
"type": "string",
"required": false,
"description": "File filter (*.ts, src/**)"
},
"max": {
"type": "integer",
"required": false,
"default": 50,
"description": "Maximum results"
}
}
}
Key principles:
// Pseudocode - Always permissive
function search(params) {
const {pattern, filter, max, ...extra} = params
const warnings = []
if (Object.keys(extra).length > 0) {
warnings.push(`Unknown params ignored: ${Object.keys(extra).join(', ')}`)
}
return {results: search(pattern, filter, max), warnings}
}
{
"data": {}, // Primary response data
"metadata": {}, // Automation flags (has_more, total, etc.)
"errors": [], // Error list (empty if none)
"warnings": [], // Warning list (unknown params, etc.)
"next_steps": "" // Guidance for user
}
Don't repeat inputs:
// Bad
{
"query": "authenticate", // User just sent this
"filter": "*.ts", // User just sent this
"results": [...]
}
// Good
{
"results": [...],
"total": 127
}
{
"results": [
{"id": "a1", "name": "...", "confidence": 0.95, "full_details": {...}}, // High confidence
{"id": "b2", "name": "...", "confidence": 0.70, "summary": "..."}, // Medium
{"id": "c3", "name": "...", "confidence": 0.40} // Low - just ID
]
}
See also: Client Guidance for comprehensive error-as-progressive-enhancement patterns including similar tool suggestions, parameter corrections, and schema hints.
{
"error": {
"code": "INVALID_PATTERN",
"message": "Regex pattern is malformed",
"details": {
"pattern": "([unclosed",
"position": 2,
"expected": "]"
},
"suggestion": "Check regex syntax. Example: \"function.*User\"",
"schema_hint": {
"pattern": {"type": "string", "required": true}
}
}
}
INVALID_INPUT - Bad input parameters
NOT_FOUND - Resource not found
PERMISSION_DENIED - Access denied
TIMEOUT - Operation timed out
INTERNAL_ERROR - Server error
RATE_LIMITED - Too many requests
UNKNOWN_TOOL - Tool name not found (suggest similar)
MISSING_REQUIRED - Required parameter missing (include schema)
{
"results": [...], // Partial results
"warnings": ["Timeout after 5s, showing partial results"],
"complete": false,
"partial": true
}
Errors should guide clients toward success:
{
"error": {
"code": "UNKNOWN_TOOL",
"message": "Tool 'serach' not found",
"suggestions": {
"did_you_mean": "search",
"similar_tools": ["search", "search_code"]
}
}
}
{
"error": {
"code": "MISSING_REQUIRED",
"message": "Required parameter 'pattern' is missing",
"schema_hint": {
"required": ["pattern"],
"optional": ["filter", "max"],
"example": {"pattern": "User", "filter": "*.ts"}
}
}
}
{
"name": "search",
"purpose": "Fast discovery",
"output": {
"results": [{"id": "...", "preview": "..."}],
"has_more": true,
"total": 127
},
"avg_tokens": 80
}
{
"name": "get_definition",
"purpose": "Detailed information",
"input": {"id": "from_search"},
"output": {
"id": "...",
"full_details": {...}
},
"avg_tokens": 200
}
{
"name": "trace_callers",
"purpose": "Deep analysis",
"input": {"symbol_id": "..."},
"output": {
"call_graph": {...},
"analysis": {...}
},
"avg_tokens": 500,
"warning": "Expensive operation"
}
// Pseudocode
function validateInput(params) {
if (!params.pattern) {
return error("INVALID_INPUT", "pattern is required")
}
if (params.max && (params.max < 1 || params.max > 1000)) {
return error("INVALID_INPUT", "max must be 1-1000")
}
// Validate but don't reject extra params
const known = ['pattern', 'filter', 'max']
const extra = Object.keys(params).filter(k => !known.includes(k))
return {valid: true, warnings: extra.length > 0 ? [`Unknown: ${extra}`] : []}
}
Tool design checklist:
Client guidance checklist:
Token budgets by tool type:
Provides process, architecture, review, hiring, and testing guidelines for engineering teams relying on AI code generation.