Skip to main content
Glama

add

Input two numbers to calculate their sum using this tool on MCP-Claude, simplifying mathematical operations with direct integration.

Instructions

Add two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • The handler function for the 'add' tool. It takes two numbers a and b, computes their sum, and returns a text response with the result.
    async ({ a, b }) => { const sum = a + b; return { content: [ { type: "text", text: `The sum of ${a} and ${b} is ${sum}`, }, ], }; } );
  • Input schema for the 'add' tool using Zod, defining parameters 'a' and 'b' as numbers.
    { a: z.number().describe("First number"), b: z.number().describe("Second number"), },
  • src/index.ts:285-303 (registration)
    Registration of the 'add' tool with server.tool(), specifying name, description, input schema, and handler function.
    server.tool( "add", "Add two numbers", { a: z.number().describe("First number"), b: z.number().describe("Second number"), }, async ({ a, b }) => { const sum = a + b; return { content: [ { type: "text", text: `The sum of ${a} and ${b} is ${sum}`, }, ], }; } );

Other Tools

Related Tools

  • @kylekanouse/Test-MCP---DEMO-MCP-Dev-1
  • @wrtnlabs/calculator-mcp
  • @zhangzhefang-github/mcp-add-server
  • @githubpradeep/calc-mcp72
  • @KrishnaPapana/mcpserverexample
  • @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/virajsamarasinghe/MCP-Claude'

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