Skip to main content

Interface: ToolDefinition<T>

Defined in: packages/core/src/utils/tools.ts:135

Tool definition (v2 - with inputSchema)

Breaking change from v1:

  • v1: Used parameters: Record<string, ToolParameter>
  • v2: Uses inputSchema: JsonSchema

Example

const weatherTool: ToolDefinition = {
name: 'get_weather',
description: 'Get weather info',
inputSchema: {
type: 'object',
properties: {
location: { type: 'string', description: 'City name' }
},
required: ['location']
},
execute: async ({ location }) => {
return { temp: 22, condition: 'sunny' };
}
};

Type Parameters

T

T extends (...args) => unknown = (...args) => unknown

Properties

description

description: string

Defined in: packages/core/src/utils/tools.ts:137


execute

execute: T

Defined in: packages/core/src/utils/tools.ts:139


inputSchema

inputSchema: JsonSchema

Defined in: packages/core/src/utils/tools.ts:138


name

name: string

Defined in: packages/core/src/utils/tools.ts:136