Skip to main content
Glama
codewithmsunke

MCP Math Server

multiply

Calculate the product of two numbers using this mathematical operation tool from the MCP Math Server for arithmetic computations.

Instructions

Multiply two numbers a * b

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • Handler function that multiplies two numbers 'a' and 'b', computes the product, and returns a text response with the result.
    async ({ a, b }) => { const product = a * b; return { content: [ { type: "text", text: `The product of ${a} and ${b} is ${product}` } ] }; }
  • Input schema definition using Zod for parameters 'a' and 'b' as numbers, along with title and description.
    { title: "Multiplication tool", description: "Multiply two numbers a * b", inputSchema: { a: z.number(), b: z.number() }, },
  • src/index.ts:95-110 (registration)
    Registration of the 'multiply' tool with the MCP server, including schema and inline handler.
    server.registerTool( "multiply", { title: "Multiplication tool", description: "Multiply two numbers a * b", inputSchema: { a: z.number(), b: z.number() }, }, async ({ a, b }) => { const product = a * b; return { content: [ { type: "text", text: `The product of ${a} and ${b} is ${product}` } ] }; } );

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/codewithmsunke/MCPMathTools'

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