Custom Tools
Why Create Custom Tools?
Tool Structure
Basic Tool Template
import { Tool, ToolHandler } from '@aidp/mcp-server';
export const myCustomTool: Tool = {
name: 'my_custom_tool',
description: 'Description of what this tool does',
parameters: {
type: 'object',
properties: {
param1: {
type: 'string',
description: 'Description of param1',
required: true,
},
param2: {
type: 'number',
description: 'Description of param2',
required: false,
default: 10,
},
},
},
handler: async (params) => {
// Tool implementation
return {
success: true,
data: {
/* result */
},
};
},
};Example 1: Nearby Restaurants Tool
Usage
Example 2: Business Comparison Tool
Example 3: Smart Recommendations Tool
Registering Custom Tools
In Configuration File
Programmatically
Best Practices
1. Clear Naming
2. Comprehensive Descriptions
3. Validate Parameters
4. Handle Errors Gracefully
5. Cache Expensive Operations
Testing Custom Tools
Quick Test
Next Steps
Support
Last updated