Tool Management
NewUpdated
The Tools namespace lets you manage a registry of tools that AI agents can discover and use. Tools are organized into categories and searchable via hybrid semantic + keyword search.
In this guide you'll learn how to:
- Create and organize tools into categories
- Search tools using natural language queries
- Manage the full tool lifecycle
Set Up Categories
Organize your tools into categories before creating tools.
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
const defiCat = await chaos.tools.categories.create({ name: 'DeFi Protocols' });
const dataCat = await chaos.tools.categories.create({ name: 'Data & Analytics' });
console.log(`Created categories: ${defiCat.id}, ${dataCat.id}`);Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Register Tools
Create tools with descriptive names and descriptions — these are used for semantic search matching.
const priceTool = await chaos.tools.create({
name: 'token-price-fetcher',
description: 'Fetches real-time and historical token prices from multiple DEXes and CEXes',
});
const liqTool = await chaos.tools.create({
name: 'liquidity-analyzer',
description: 'Analyzes liquidity depth and slippage across Uniswap, Curve, and Balancer pools',
});
console.log(`Registered: ${priceTool.name}, ${liqTool.name}`);Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Search Tools
Use natural language queries to find relevant tools. Hybrid search combines semantic understanding with keyword matching.
const results = await chaos.tools.searchHybrid({
queries: [
'I need to check token prices',
'analyze DEX liquidity',
],
});
for (const r of results) {
console.log(`\nQuery: "${r.query}"`);
for (const tool of r.results) {
console.log(` ✓ ${tool.name} — ${tool.description}`);
}
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
List & Browse
Browse the full tool registry with pagination and filtering.
// List all tools
const { data: allTools, total } = await chaos.tools.list({ page: 1, limit: 50 });
console.log(`${total} tools registered`);
// List all categories
const { data: cats } = await chaos.tools.categories.list();
for (const c of cats) {
console.log(`Category: ${c.name} (${c.id})`);
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Was this helpful?