subtract
Calculate the difference between two numbers using a simple subtraction tool. Input the minuend and subtrahend to get the result quickly.
Instructions
Subtract two numbers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | First number (minuend) | |
| b | Yes | Second number (subtrahend) |
Implementation Reference
- src/tools/calculator-tools.ts:47-54 (handler)Handler function that takes two numbers 'a' and 'b', computes a - b, and returns the result as a text content block.async ({ a, b }) => ({ content: [ { type: "text", text: `${a} - ${b} = ${a - b}` } ] })
- src/tools/calculator-tools.ts:42-45 (schema)Zod input schema defining the two numeric parameters for subtraction.inputSchema: { a: z.number().describe("First number (minuend)"), b: z.number().describe("Second number (subtrahend)") }
- src/tools/calculator-tools.ts:37-55 (registration)Registration of the 'subtract' tool with server.registerTool, including schema and handler.server.registerTool( "subtract", { title: "Subtraction Tool", description: "Subtract two numbers", inputSchema: { a: z.number().describe("First number (minuend)"), b: z.number().describe("Second number (subtrahend)") } }, async ({ a, b }) => ({ content: [ { type: "text", text: `${a} - ${b} = ${a - b}` } ] }) );