calculate-sum
Add two numbers together to get their total sum. This tool performs basic arithmetic addition for any numeric values provided.
Instructions
Calculates the sum of two numbers
Input Schema
TableJSON 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 calculate-sum tool logic: sums two input numbers and returns the result as MCP 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)Zod input schema defining 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 complete tool definition object for 'calculate-sum' exported in TOOLS, which is used by the MCP server for listing and calling the tool."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), }, ], }; }, },