Function: defineTool()
defineTool<
T>(definition):ToolDefinition<T>
Defined in: packages/core/src/utils/tools.ts:375
Define a tool with JSON Schema for input validation
Type Parameters
T
T extends (...args) => unknown
Parameters
definition
Returns
Example
const weatherTool = defineTool({
name: 'get_weather',
description: 'Get weather info',
inputSchema: {
type: 'object',
properties: {
location: { type: 'string' }
},
required: ['location']
},
execute: async ({ location }) => {
return { temp: 22, condition: 'sunny' };
}
});