Tools

New
Updated

The chaos.tools namespace provides CRUD operations for a tool registry and semantic hybrid search. Tools represent capabilities that AI agents can discover and invoke. Organize tools into categories via the chaos.tools.categories sub-namespace.

tools-quickstart.ts
import { Chaos } from '@chaoslabs/ai-sdk';
 
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
 
// Create a tool
const tool = await chaos.tools.create({
  name: 'price-oracle',
  description: 'Fetches real-time token prices from DEXes and CEXes',
});
 
// List tools with filtering
const { data: tools, total } = await chaos.tools.list({ limit: 20, search: 'price' });
 
// Hybrid semantic + keyword search
const results = await chaos.tools.searchHybrid({
  queries: ['fetch token prices', 'check wallet balances'],
});
 
// Categories
const cat = await chaos.tools.categories.create({ name: 'DeFi Protocols' });
const { data: categories } = await chaos.tools.categories.list();

Method Reference

Tools

MethodHTTPEndpointReturns
list(params?)GET/v1/toolsToolListResponse
create(params)POST/v1/toolsTool
update(toolId, params)PUT/v1/tools/{toolId}{ message: string }
delete(toolId)DELETE/v1/tools/{toolId}void
searchHybrid(params)POST/v1/tools/search/hybrid/batchQueryToolSearchResult[]

Categories (chaos.tools.categories)

MethodHTTPEndpointReturns
categories.list(params?)GET/v1/tools/categoriesToolCategoryListResponse
categories.create(params)POST/v1/tools/categoriesToolCategory
categories.update(categoryId, params)PUT/v1/tools/categories/{categoryId}ToolCategory
categories.delete(categoryId)DELETE/v1/tools/categories/{categoryId}void

Core Types

tools-types.ts
interface Tool {
  id: string;
  name: string;
  description?: string | null;
}
 
interface ToolListParams {
  page?: number;
  limit?: number;
  categoryId?: string;
  search?: string;
}
 
interface ToolListResponse {
  total: number;
  data: Tool[];
}
 
interface CreateToolParams {
  name: string;
  [key: string]: unknown;
}
 
interface UpdateToolParams {
  [key: string]: unknown;
}
 
interface BatchHybridSearchParams {
  queries: string[];
}
 
interface QueryToolSearchResult {
  query: string;
  results: Tool[];
}
 
interface ToolCategory {
  id: string;
  name: string;
}
 
interface ToolCategoryListParams {
  page?: number;
  limit?: number;
  search?: string;
}
 
interface ToolCategoryListResponse {
  total: number;
  data: ToolCategory[];
}
 
interface CreateToolCategoryParams {
  name: string;
}
 
interface UpdateToolCategoryParams {
  name?: string;
}
Was this helpful?