subtract
Perform subtraction by subtracting the subtrahend from the minuend using the Math-MCP server. Input two numbers to get the accurate result of the operation.
Instructions
Subtracts the second number from the first number
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| minuend | Yes | The number to subtract from (minuend) | |
| subtrahend | Yes | The number being subtracted (subtrahend) |
Implementation Reference
- src/Classes/Arithmetic.ts:19-22 (handler)The core handler function that executes the subtraction logic: minuend - subtrahend.static subtract(minuend: number, subtrahend: number) { const difference = minuend - subtrahend return difference }
- src/index.ts:45-46 (schema)Zod input schema for the 'subtract' tool defining the two number parameters.minuend: z.number().describe("The number to subtract from (minuend)"), subtrahend: z.number().describe("The number being subtracted (subtrahend)")
- src/index.ts:44-56 (registration)Registration of the 'subtract' tool on the MCP server, including schema and wrapper handler.mathServer.tool("subtract", "Subtracts the second number from the first number", { minuend: z.number().describe("The number to subtract from (minuend)"), subtrahend: z.number().describe("The number being subtracted (subtrahend)") }, async ({ minuend, subtrahend }) => { const value = Arithmetic.subtract(minuend, subtrahend) return { content: [{ type: "text", text: `${value}` }] } })