Skip to main content

Interface: ToolDefinition<T>

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

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:142


execute

execute: T

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


function?

optional function?: T

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

Deprecated

Use execute instead.


inputSchema

inputSchema: JsonSchema

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


name

name: string

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