number_add
Add two numbers to calculate their sum. This tool performs basic arithmetic addition for quick mathematical calculations.
Instructions
简单的求和工具,当想要计算两个数字相加后的结果时调用
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | 第一个数字 | |
| b | Yes | 第二个数字 |
Implementation Reference
- src/index.ts:27-29 (handler)Handler function that takes two numbers a and b, adds them, converts to string, and returns as text content in the response.async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }], })
- src/index.ts:23-26 (schema)Input schema defined using Zod for parameters 'a' and 'b', both required numbers with descriptions.{ a: z.number().describe("第一个数字"), b: z.number().describe("第二个数字"), },
- src/index.ts:20-30 (registration)Registration of the 'number_add' tool on the MCP server, including name, description, input schema, and handler.server.tool( "number_add", "简单的求和工具,当想要计算两个数字相加后的结果时调用", { a: z.number().describe("第一个数字"), b: z.number().describe("第二个数字"), }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }], }) );