add
Calculate the sum of two numbers. Provides a simple way to add numbers together.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- src/mcpServer.js:17-22 (registration)Registers the 'add' tool on the MCP server with the name 'add'.
server.tool("add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] }) ); - src/mcpServer.js:19-21 (handler)Handler function for the 'add' tool - takes two numbers a and b, returns their sum as text.
async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] }) - src/mcpServer.js:18-18 (schema)Input schema for the 'add' tool - expects two number parameters 'a' and 'b' validated with Zod.
{ a: z.number(), b: z.number() },