calculate-sum
Add two numbers together to get their total sum. This tool performs basic arithmetic addition for any numerical inputs.
Instructions
Calculates the sum of two numbers
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | The first number | |
| b | Yes | The second number |
Implementation Reference
- src/tools.ts:10-19 (handler)The handler function that executes the core logic of the 'calculate-sum' tool by adding the two input numbers and returning the result as text content.
handler: async ({ a, b }: { a: number; b: number }) => { return { content: [ { type: "text" as const, text: String(a + b), }, ], }; }, - src/tools.ts:6-9 (schema)The Zod schema defining the input parameters 'a' and 'b' as numbers for the 'calculate-sum' tool.
inputSchema: z.object({ a: z.number().describe("The first number"), b: z.number().describe("The second number"), }), - src/tools.ts:4-20 (registration)The registration of the 'calculate-sum' tool within the exported TOOLS object, which is used by the MCP server's listTools and callTool handlers.
"calculate-sum": { description: "Calculates the sum of two numbers", inputSchema: z.object({ a: z.number().describe("The first number"), b: z.number().describe("The second number"), }), handler: async ({ a, b }: { a: number; b: number }) => { return { content: [ { type: "text" as const, text: String(a + b), }, ], }; }, },