Tools
Tools are functions that agents can call to perform specific actions — like fetching data from an API, querying a database, sending a message, or processing information. Each tool is defined with inputs, outputs, and execution code.
Creating a Tool
Click the + Create button to define a new tool. Each tool needs:
- Name — a short camelCase verb (e.g.,
getWeather,sendEmail) - Description — what the tool does and what it returns. The LLM reads this to decide when to use the tool
- Input fields — parameters the LLM provides at runtime (e.g., city, query, message)
- User fields — credentials and config the user stores once (e.g., API keys, tokens)
- Output fields — what the tool returns (for documentation)
- Call code — the JavaScript that executes when the tool is invoked
Input Fields vs User Fields
| Field Type | Who Provides | Use For | Examples |
|---|---|---|---|
| Input fields | LLM at runtime | Dynamic data per call | city, query, message, itemId |
| User fields | User stores once | Credentials and config | apiKey, username, password, token |
| Output fields | Tool returns | Documentation only | temperature, results, success |
Important: Never add API keys or passwords as input fields. The LLM sees input fields but never sees user fields. Use user fields for all secrets and credentials.
Writing Call Code
The code editor gives you access to:
| Variable | Description |
|---|---|
data | All inputs merged (inputFields + userFields) |
axios | HTTP client for making API requests |
_ | Lodash utility library |
crypto | Node.js crypto module |
f | Function config (f.url, f.name) |
config | Credentials from the auth service |
Example
javascript
// A simple tool that fetches weather data
const city = data.city;
const apiKey = data.apiKey; // from userFields
const response = await axios.get(
`https://api.weather.com/v1/current?city=${city}&key=${apiKey}`
);
return {
temperature: response.data.temp,
condition: response.data.condition
};
Quick Tips
- Write descriptive tool descriptions — the LLM uses them to decide when to invoke the tool
- Use user fields for API keys and secrets, never input fields
- Keep call code focused — one tool, one action
- Test your tool with sample inputs before attaching it to an agent
- Mark fields as required when the tool can't function without them