What is a Tool?
A tool is a single function that your AI agent can execute. Tools are the building blocks that give your agent real capabilities.Think of it as:
A TypeScript function that does ONE specific thing - like “search products” or “check order status”
v3.0.0 Update: Tools are bundled into skills, which are then added to your agent through the
LuaAgent class. See Agent Concept for the complete pattern.Anatomy of a Tool
Name
Unique identifier (snake_case)
Description
Clear explanation of purpose
Input Schema
Zod validation for inputs
Execute Function
The actual logic
Good vs Bad Tools
- ❌ Bad Tool
- ✅ Good Tool
- Unclear name
- Vague description
- Generic input
- No error handling
- Unclear return value
Tool Types
1. External API Tools
Connect to any external service:2. Platform API Tools
Use Lua’s built-in APIs:3. Hybrid Tools
Mix both approaches:4. Conditional Tools
Tools that are only available under certain conditions:The
condition function runs before the tool is offered to the AI. If it returns false or throws an error, the tool is hidden from the conversation.- Premium/paid features
- User verification status
- Feature flags & A/B testing
- Region-specific tools
- Time-based access
Tool Best Practices
Use Descriptive Names
Use Descriptive Names
Write Clear Descriptions
Write Clear Descriptions
Validate Inputs
Validate Inputs
Handle Errors
Handle Errors
Return Structured Data
Return Structured Data
Testing Tools
- Test Individual Tool
- Test in Conversation
- Select specific tool
- Enter test inputs
- Verify output
- Debug tool logic
Managing Tools
Create
Write tools in
src/tools/Bundle
Add to skills in
src/index.ts
