add
Calculate the sum of two numbers by inputting numerical values for addition operations.
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
- demo.ts:94-105 (handler)Handler logic for the 'add' tool: extracts parameters a and b, computes their sum, and returns a text response with the result.if (name === "add") { const { a, b } = args as { a: number; b: number }; const result = a + b; return { content: [ { type: "text", text: `The sum of ${a} and ${b} is ${result}`, }, ], }; }
- demo.ts:25-42 (schema)Schema definition for the 'add' tool, including name, description, and input schema with required number parameters 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"], }, },