subtract
Calculate the difference between two numbers by subtracting one from another. This arithmetic tool helps solve subtraction problems quickly.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- src/index.ts:28-33 (handler)Handler function for the 'subtract' tool. It takes two numbers a and b, computes a - b, and returns a text content with the result in Japanese.async ({ a, b }) => ({ content: [{ type: "text", text: `${a} と ${b} の引き算の結果: ${a - b}` }] })
- src/index.ts:27-27 (schema)Zod schema defining input parameters for the 'subtract' tool: two numbers 'a' and 'b'.{ a: z.number(), b: z.number() },
- src/index.ts:25-34 (registration)Registration of the 'subtract' tool using McpServer's tool method, specifying name, input schema, and handler function.server.tool( "subtract", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: `${a} と ${b} の引き算の結果: ${a - b}` }] }) );