Skip to main content

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”
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

Problems:
  • 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.
Use cases for conditional tools:
  • Premium/paid features
  • User verification status
  • Feature flags & A/B testing
  • Region-specific tools
  • Time-based access
A hidden tool is left out of the prompt’s tool list, but the agent still sees the skill’s name and context, so it can say “that’s a premium feature”. When the existence of the capability is itself sensitive, gate the whole skill instead — LuaSkill takes the same condition, and a hidden skill’s name, context, and tool names are left out of the prompt entirely. See Conditional Skills.

Tool Best Practices

Testing Tools

  • 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

Test

Deploy

Next Steps

Learn About Skills

How tools are bundled into skills

See Tool Examples

30+ working tool examples

API Reference

Complete LuaTool interface documentation

Build Your First Tool

Step-by-step tutorial