import { BaseTool } from './BaseTool'; export class CalculateTool extends BaseTool<{ expression: string }> { constructor() { super( 'calculate', 'Perform a calculation', { expression: { type: 'string', description: 'The mathematical expression to evaluate', required: 'true', max_inputs: '1', }, }, 'Provide a mathematical expression to calculate that would work with JavaScript eval().', 'Runs a calculation and returns the number - uses JavaScript so be sure to use floating point syntax if necessary' ); } async execute(args: { expression: string }): Promise { // Note: Using eval() can be dangerous. Consider using a safer alternative. const result = eval(args.expression); return [{ type: 'text', text: result.toString() }]; } }