aiTool
Syntax
aiTool(name, description, callable)Parameters
Parameter
Type
Required
Description
Returns
Examples
Basic Tool
// Simple weather tool
weatherTool = aiTool(
"get_weather",
"Get current weather for a location",
( location ) => {
return "72°F and sunny in #location#";
}
);
// Use with agent
agent = aiAgent(
name: "WeatherBot",
tools: [ weatherTool ]
);
response = agent.run( "What's the weather in Paris?" );
// Agent automatically calls get_weather("Paris")Tool with Multiple Parameters
Database Lookup Tool
API Integration Tool
Multiple Tools
Tool with Rich Output
Tool with Validation
Tool Function Requirements
Return Value
Parameters
Error Handling
Use Cases
✅ External Data Retrieval
✅ Calculations
✅ System Actions
✅ API Integrations
✅ Database Operations
❌ Heavy Processing
❌ Stateful Operations
Tool Selection
Notes
Related Functions
Best Practices
Last updated