division
Perform precise division calculations by entering a numerator and denominator. The tool outputs the result accurately, aiding in mathematical problem-solving tasks.
Instructions
Divides the first number by the second number
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| denominator | Yes | The number to divide by (denominator) | |
| numerator | Yes | The number being divided (numerator) |
Implementation Reference
- src/index.ts:80-92 (registration)Registers the 'division' MCP tool with input schema (numerator, denominator), description, and an async handler that calls Arithmetic.division and returns the result as text content.mathServer.tool("division", "Divides the first number by the second number", { numerator: z.number().describe("The number being divided (numerator)"), denominator: z.number().describe("The number to divide by (denominator)") }, async ({ numerator, denominator }) => { const value = Arithmetic.division(numerator, denominator) return { content: [{ type: "text", text: `${value}` }] } })
- src/index.ts:81-82 (schema)Zod schema defining input parameters for the 'division' tool: numerator and denominator as numbers.numerator: z.number().describe("The number being divided (numerator)"), denominator: z.number().describe("The number to divide by (denominator)")
- src/index.ts:83-91 (handler)MCP tool handler function for 'division': invokes Arithmetic.division and formats the result as MCP response content.}, async ({ numerator, denominator }) => { const value = Arithmetic.division(numerator, denominator) return { content: [{ type: "text", text: `${value}` }] }
- src/Classes/Arithmetic.ts:41-44 (helper)Static helper method in Arithmetic class that performs the actual division operation (numerator / denominator).static division(numerator: number, denominator: number) { const quotient = numerator / denominator return quotient }