subtract
Calculate the difference between two numbers by subtracting the second value from the first. Use this tool to perform subtraction operations and find numerical differences.
Instructions
Subtract second number from first number
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | Number to subtract from | |
| b | Yes | Number to subtract |
Implementation Reference
- src/index.ts:147-158 (handler)Handler for the 'subtract' tool: extracts 'a' and 'b' from arguments, computes a - b, and returns formatted result as text content.case "subtract": { const { a, b } = args as { a: number; b: number }; const result = a - b; return { content: [ { type: "text", text: `${a} - ${b} = ${result}`, }, ], }; }
- src/index.ts:41-54 (schema)Input schema for 'subtract' tool defining parameters 'a' (number to subtract from) and 'b' (number to subtract), both required.inputSchema: { type: "object", properties: { a: { type: "number", description: "Number to subtract from", }, b: { type: "number", description: "Number to subtract", }, }, required: ["a", "b"], },
- src/index.ts:38-55 (registration)Registration of the 'subtract' tool in the list of tools, including name, description, and input schema.{ name: "subtract", description: "Subtract second number from first number", inputSchema: { type: "object", properties: { a: { type: "number", description: "Number to subtract from", }, b: { type: "number", description: "Number to subtract", }, }, required: ["a", "b"], }, },