Building Custom Tools
Build reusable, annotated, and class-based tools that your AI agents can call during conversations.
Quick Tool via aiTool()
searchTool = aiTool(
name : "searchProducts",
description : "Search the product catalog",
parameters : [
{ name: "query", type: "string", description: "Search term", required: true },
{ name: "maxResults", type: "number", description: "Max results to return", required: false }
],
callback : ( query, maxResults = 10 ) => productService.search( query, maxResults )
)
agent = aiAgent( name: "shop-assistant", tools: [ searchTool ] )Accessing Conversation Context (_chatRequest)
_chatRequest)Register via Tool Registry
Annotated Class Tools (@AITool)
@AITool)Format
Effect
Extending BaseTool
Fluent Schema Helpers
Tool Lifecycle Events
Event
Fires When
Context Keys
Related Pages
Last updated