add
Calculate the sum of two numbers. Provides a simple way to add numbers together.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"a": "<a>",
"b": "<b>"
},
"name": "add"
}
}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() },