add
Calculate the sum of two numbers using this mathematical tool. Enter two numerical values to perform addition and get the total result.
Instructions
Add two numbers together
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | First number to add | |
| b | Yes | Second number to add |
Implementation Reference
- src/index.ts:134-145 (handler)The handler function that executes the 'add' tool logic: destructures arguments a and b, computes their sum, and returns a text response with the result.case "add": { const { a, b } = args as { a: number; b: number }; const result = a + b; return { content: [ { type: "text", text: `${a} + ${b} = ${result}`, }, ], }; }
- src/index.ts:20-37 (schema)The schema definition for the 'add' tool, returned in ListTools response, specifying name, description, and input schema with required number properties a and b.{ name: "add", description: "Add two numbers together", inputSchema: { type: "object", properties: { a: { type: "number", description: "First number to add", }, b: { type: "number", description: "Second number to add", }, }, required: ["a", "b"], }, },