subtract
Calculate the difference between two numbers by subtracting the second value from the first value. 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)The switch case handler for the 'subtract' tool. It extracts parameters 'a' and 'b', computes 'a - b', and returns a text response with the formatted result.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:38-55 (registration)The registration of the 'subtract' tool in the list of available tools, including its name, description, and input schema definition.{ 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"], }, },
- src/index.ts:41-54 (schema)The input schema for the '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"], },