add
Add two numbers together to calculate their sum. This tool performs basic addition for mathematical calculations.
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)Handler for the 'add' tool: 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:23-36 (schema)Input schema defining 'a' and 'b' as required number properties for the 'add' tool.inputSchema: { type: "object", properties: { a: { type: "number", description: "First number to add", }, b: { type: "number", description: "Second number to add", }, }, required: ["a", "b"], },
- src/index.ts:20-37 (registration)Registration of the 'add' tool in the ListTools response, including name, description, and schema.{ 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"], }, },