| 5 | } |
| 6 | |
| 7 | const toolCalculator = () => ({ |
| 8 | run: calculator, |
| 9 | type: 'function' as const, |
| 10 | function: { |
| 11 | name: 'calculator', |
| 12 | description: |
| 13 | `A tool that can evaluate mathematical expressions. ` + |
| 14 | `Example expressions: ` + |
| 15 | `'5.6 * (5 + 10.5)', '7.86 cm to inch', 'cos(80 deg) ^ 4'.`, |
| 16 | parameters: { |
| 17 | type: 'object', |
| 18 | required: ['expression'], |
| 19 | properties: { |
| 20 | expression: { |
| 21 | type: 'string', |
| 22 | description: 'The mathematical expression to evaluate.', |
| 23 | }, |
| 24 | }, |
| 25 | }, |
| 26 | }, |
| 27 | }); |
| 28 | |
| 29 | export default toolCalculator; |