Skip to main content
Glama

add

Add two numbers together using the Math-MCP server’s API, enabling accurate numerical calculations for LLMs by processing defined input values.

Instructions

Adds two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNumberYesThe first addend
secondNumberYesThe second addend

Implementation Reference

  • src/index.ts:26-38 (registration)
    Registration of the 'add' tool including description, input schema using Zod, and the handler function that delegates to Arithmetic.add and formats the response.
    mathServer.tool("add", "Adds two numbers together", { firstNumber: z.number().describe("The first addend"), secondNumber: z.number().describe("The second addend") }, async ({ firstNumber, secondNumber }) => { const value = Arithmetic.add(firstNumber, secondNumber) return { content: [{ type: "text", text: `${value}` }] } })
  • The handler function for the 'add' tool, which performs the addition via Arithmetic.add and returns a text response.
    }, async ({ firstNumber, secondNumber }) => { const value = Arithmetic.add(firstNumber, secondNumber) return { content: [{ type: "text", text: `${value}` }] } })
  • Zod schema defining the input parameters for the 'add' tool: two numbers.
    firstNumber: z.number().describe("The first addend"), secondNumber: z.number().describe("The second addend")
  • Arithmetic.add static method implementing the core addition logic.
    static add(firstNumber: number, secondNumber: number): number { const sum = firstNumber + secondNumber; return sum }

Other Tools

Related Tools

  • @zhangzhefang-github/mcp-add-server
  • @wrtnlabs/calculator-mcp
  • @YuheiNakasaka/arithmetic-mcp-server
  • @mikefey/mcp-server
  • @githubpradeep/calc-mcp72
  • @EthanHenrickson/math-mcp

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