add
Perform addition of two numbers using specified inputs. Simplify arithmetic calculations within the Hello-MCP server for seamless integration and processing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- src/mcpServer.js:17-22 (registration)Registration of the MCP 'add' tool. Includes inline Zod schema for numeric inputs 'a' and 'b', and an async handler that returns the sum as text content.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)The handler function for the 'add' tool, which adds the inputs a and b and returns the result as a text content block.async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] })
- src/mcpServer.js:18-18 (schema)Zod schema defining the input parameters for the 'add' tool: two numbers a and b.{ a: z.number(), b: z.number() },