Custom Tool Block
What it does: Create your own specialized tools that AI agents can use, extending their capabilities with custom functionality tailored to your needs.
In simple terms: Custom Tools are like teaching your AI new skills. If there's something specific you need the AI to do - like calculate shipping costs, validate data, or format information - you can create a custom tool that does exactly that.
When to Use This
Use Custom Tools when you need:
- ✅ Specialized functionality not available in built-in tools
- ✅ Custom business logic for AI agents
- ✅ Data transformations during agent workflows
- ✅ Integration with internal systems
- ✅ Reusable capabilities across multiple agents
Example: Create a "Calculate Quote" tool that takes product specs and returns a price estimate based on your custom pricing logic.
Key Features
- Flexible Design: Define exactly what inputs the tool accepts
- Custom Logic: Implement any functionality you need
- AI Integration: AI agents automatically know when to use your tool
- Reusable: Once created, use the tool in any workflow
- Self-Describing: Tool description helps AI understand when to use it
How Custom Tools Work
- You define the tool: Describe what it does and what inputs it needs
- You implement the logic: Define how the tool processes inputs
- AI sees your tool: Agent understands the tool's purpose from your description
- AI uses it naturally: When relevant, the agent calls your tool with appropriate inputs
- Results flow back: Tool output is used in the agent's response
Setup Guide
Step 1: Define Your Tool
Give your tool a clear identity:
- Name: Short, descriptive identifier (e.g., "calculate_shipping")
- Description: Explain what the tool does and when to use it
- Example: "Calculates shipping cost based on package weight and destination"
Step 2: Define Input Parameters
Specify what information your tool needs:
| Parameter Property | What It Means |
|---|---|
| Name | The parameter identifier |
| Type | What kind of data (text, number, boolean) |
| Description | What this parameter is for |
| Required | Whether AI must provide this value |
Step 3: Implement the Logic
Define what your tool actually does when called:
- Process the input parameters
- Perform calculations or lookups
- Return the result
Step 4: Connect to AI Agent
Add your custom tool to an AI agent's toolkit. The agent will see your tool's name and description and use it when appropriate.
Common Use Cases
Business Calculations
Create tools for pricing calculations, discount logic, tax computation, or any formula-based operations.
Data Validation
Build tools that check if data meets your business rules - valid email formats, acceptable ranges, or required formats.
Formatting and Transformation
Convert data between formats, standardize inputs, or prepare data for other systems.
Lookup Operations
Create tools that fetch information from internal sources based on provided identifiers.
Custom Integrations
Connect to internal APIs or services that don't have built-in tool support.
Creating Effective Tools
Writing Good Descriptions
Your tool description tells the AI when to use it. Be clear and specific:
Good description: "Calculates the total shipping cost for a package. Use when a customer asks about shipping prices. Takes package weight in pounds and destination zip code."
Poor description: "Does shipping stuff"
Choosing Parameters
Define only the parameters your tool truly needs:
| Good Practice | Avoid |
|---|---|
| Specific types (number for age) | Generic "data" parameters |
| Clear descriptions | Cryptic abbreviations |
| Required vs optional clarity | Everything required |
What You Get Back
After your custom tool runs:
- Tool Output: Whatever result your tool logic produces
- Success Status: Whether the tool completed successfully
- Execution Info: Details about the tool call
Tips for Success
- Write clear descriptions - AI decides when to use tools based on descriptions
- Keep tools focused - One tool, one purpose
- Use descriptive parameter names - "customer_email" not "ce"
- Handle edge cases - What if inputs are missing or invalid?
- Test thoroughly - Verify tools work with various inputs
Troubleshooting
| Problem | Likely Cause | Solution |
|---|---|---|
| AI doesn't use tool | Description unclear | Rewrite description to be more specific |
| Wrong parameters passed | Parameter names confusing | Rename parameters to be clearer |
| Tool errors | Logic issues | Check your implementation for bugs |
| Unexpected results | Input validation missing | Add validation for incoming parameters |
Best Practices
- Name tools clearly - Use action words like "calculate", "validate", "lookup"
- Document thoroughly - Future you will thank present you
- Version your tools - Keep track of changes to tool logic
- Monitor usage - See how often and how well tools are being used
- Iterate and improve - Refine tools based on real usage