What are Custom Tools?
Custom Tools are Python functions that orchestrate multiple MCP servers and can be deployed as:- REST API endpoints - Call from any system
- Reusable MCP tools - Available in Claude and other MCP clients
- Scheduled jobs - Run automatically on a schedule
Custom Tools let you write business logic once and reuse it everywhere - from Claude conversations to external integrations.
Creating a Custom Tool
Step 1: Write Your Code
Use the DataGen SDK to call MCP tools as Python functions:Step 2: Define Input Schema
Specify what parameters your tool accepts using JSON Schema:Step 3: Define Output Variables
List the variables your code produces:Step 4: Configure Dependencies
Specify what your tool needs:| Dependency Type | Description | Example |
|---|---|---|
| MCP Servers | Which MCP servers to connect | ["Linear", "Gmail"] |
| Secrets | Environment variables needed | ["OPENAI_API_KEY"] |
| Imports | Python packages to import | ["pandas", "httpx"] |
Deploying Your Tool
Ask Claude to deploy using natural language:Deployment Examples
Basic deployment:With scheduling:With parameters:
deployCode tool directly:
Testing Your Tool
Test with executeCode First
Before deploying, test your code withexecuteCode:
Test Deployed Tool
After deployment, test withsubmitCustomToolRun:
Managing Custom Tools
Finding Your Tools
UsesearchCustomTools to find your deployed tools:
Updating a Tool
UseupdateCustomTool to modify an existing deployment:
- Python code
- Input/output schemas
- Dependencies
- Name and description
Checking Tool Status
UsecheckRunStatus to monitor running tools:
Example: Lead Enrichment Tool
Here’s a complete example of a custom tool that enriches leads:- MCP Servers:
["Perplexity", "LinkedIn"] - Output Variables:
["result", "total_enriched"]
Best Practices
Keep tools focused
Keep tools focused
Each tool should do one thing well. Create separate tools for different tasks rather than one massive tool.
Handle errors gracefully
Handle errors gracefully
Use try/except blocks and return meaningful error messages:
Use descriptive names
Use descriptive names
Name tools clearly:
enrich_company_data not tool1. Good descriptions help Claude understand when to use your tool.Test before deploying
Test before deploying
Always test with
executeCode first. Deployed tools are harder to debug.What’s Next?
Deploy & Schedule
Learn about API endpoints and scheduling options
Connect MCPs
Add more MCP servers to use in your tools
Deploy Agents
Run Claude Code agents on schedule
Built-in Tools
See examples of pre-built tools