Represents a tool specification with an execute function.
ToolSpec
const toolSpec: ToolSpec = { name: "WeatherFetcher", description: "Fetches weather information.", arguments: { location: { description: "The location for which to fetch the weather.", required: true } }, execute: async (args) => { const { location } = args || {}; return `Weather in ${location}: Sunny, 72°F`; }}; Copy
const toolSpec: ToolSpec = { name: "WeatherFetcher", description: "Fetches weather information.", arguments: { location: { description: "The location for which to fetch the weather.", required: true } }, execute: async (args) => { const { location } = args || {}; return `Weather in ${location}: Sunny, 72°F`; }};
Arguments required by the tool, with descriptions for each argument.
Optional
A description of what the tool does.
The function to execute the tool with the provided arguments.
The name of the tool.
Represents a tool specification with an execute function.
ToolSpec
Example