add
Perform addition of two numbers using the MCP server. Input two numerical values to get their sum via the Arithmetic MCP Server's dedicated tool.
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: takes two numbers a and b, computes their sum, and returns a text response with the result.async ({ a, b }) => ({ content: [{ type: "text", text: `${a} と ${b} の足し算の結果: ${a + b}` }] })
- src/index.ts:15-15 (schema)Input schema for the 'add' tool: requires two numbers 'a' and 'b' validated with Zod.{ a: z.number(), b: z.number() },
- src/index.ts:13-22 (registration)Registration of the 'add' tool using server.tool, including name, schema, and inline handler.server.tool( "add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: `${a} と ${b} の足し算の結果: ${a + b}` }] }) );