number_add
Calculate the sum of two numbers using this tool. Input two numeric values to return the result of their addition quickly and accurately.
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, and returns the result as a text content block.async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }], })
- src/index.ts:23-26 (schema)Zod input schema defining parameters a and b as numbers with descriptions.{ a: z.number().describe("第一个数字"), b: z.number().describe("第二个数字"), },
- src/index.ts:20-30 (registration)Registration of the 'number_add' tool using server.tool(), including name, description, input schema, and handler function.server.tool( "number_add", "简单的求和工具,当想要计算两个数字相加后的结果时调用", { a: z.number().describe("第一个数字"), b: z.number().describe("第二个数字"), }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }], }) );