add
Perform addition calculations by inputting two numbers to get their sum. This tool handles basic arithmetic operations for mathematical computations.
Instructions
簡單的加法計算工具
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- main.ts:26-31 (registration)Registration of the 'add' tool using server.tool, including inline schema and handler.server.tool("add", "簡單的加法計算工具", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] }) );
- main.ts:27-27 (schema)Zod schema defining input parameters a and b as numbers.{ a: z.number(), b: z.number() },
- main.ts:28-30 (handler)Handler function that adds the two input numbers and returns the result as a text content block.async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] })