add
Add two numbers together to calculate their sum. Use this tool to perform basic arithmetic addition operations within the MCP Document Server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- tools/index.js:9-11 (handler)The handler function that performs the addition of two numbers 'a' and 'b' and returns the result as text content.async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] })
- tools/index.js:8-8 (schema)Zod schema defining the input parameters 'a' and 'b' as numbers for the 'add' tool.{ a: z.number(), b: z.number() },
- tools/index.js:7-12 (registration)The registration of the 'add' tool on the MCP server, including name, schema, and handler.mcpServer.tool("add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] }) );
- server.js:21-21 (registration)Invocation of registerTools which includes the 'add' tool registration.registerTools(mcpServer);