Skip to main content
Glama

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
NameRequiredDescriptionDefault
SecondNumberYesThe second number
firstNumberYesThe 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}`
            }]
        }
    })
  • 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}`
            }]
        }
    })
  • Zod-based input schema for the 'multiply' tool parameters.
    firstNumber: z.number().describe("The first number"),
    SecondNumber: z.number().describe("The second number")
  • 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
    }
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EthanHenrickson/math-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server