multiply
Perform precise multiplication of two numbers using the Math-MCP server. Input two numerical values to calculate their product accurately through a simple API.
Instructions
Multiplies two numbers together
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| SecondNumber | Yes | The second number | |
| firstNumber | Yes | The first number |
Implementation Reference
- src/index.ts:62-74 (registration)Registration of the 'multiply' MCP tool, including schema definition and inline handler function that delegates to Arithmetic.multiply and formats the response.mathServer.tool("multiply", "Multiplies two numbers together", { firstNumber: z.number().describe("The first number"), SecondNumber: z.number().describe("The second number") }, async ({ firstNumber, SecondNumber }) => { const value = Arithmetic.multiply(firstNumber, SecondNumber) return { content: [{ type: "text", text: `${value}` }] } })
- src/index.ts:65-74 (handler)The handler function executed when the 'multiply' tool is called. It performs the multiplication via helper and returns a standardized MCP response.}, async ({ firstNumber, SecondNumber }) => { const value = Arithmetic.multiply(firstNumber, SecondNumber) return { content: [{ type: "text", text: `${value}` }] } })
- src/index.ts:63-64 (schema)Zod-based input schema for the 'multiply' tool parameters.firstNumber: z.number().describe("The first number"), SecondNumber: z.number().describe("The second number")
- src/Classes/Arithmetic.ts:30-33 (helper)Arithmetic helper static method implementing the multiplication logic called by the tool handler.static multiply(firstNumber: number, secondNumber: number) { const product = firstNumber * secondNumber return product }