add
Perform basic addition of two numbers using this tool. Input two numerical values to calculate their sum quickly and accurately.
Instructions
簡單的加法計算工具
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- main.ts:28-30 (handler)The asynchronous handler function that takes two numbers a and b, computes their sum, and returns it as a text content block.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:26-31 (registration)Registers the 'add' tool with name, description, schema, and inline handler on the MCP server.server.tool("add", "簡單的加法計算工具", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] }) );