add
Add two numbers together to calculate their sum. This arithmetic tool performs basic addition operations for mathematical calculations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- src/index.ts:16-21 (handler)Handler function for the 'add' tool that computes a + b and returns the result as text content.async ({ a, b }) => ({ content: [{ type: "text", text: `${a} と ${b} の足し算の結果: ${a + b}` }] })
- src/index.ts:15-15 (schema)Input schema for the 'add' tool: two numbers a and b using Zod.{ a: z.number(), b: z.number() },
- src/index.ts:13-22 (registration)Registration of the 'add' tool on the McpServer instance.server.tool( "add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: `${a} と ${b} の足し算の結果: ${a + b}` }] }) );