Skip to main content
Glama
bahfahh

Basic Math MCP Server

sum

Add two numbers to calculate their sum. Input two numerical values, and this tool will return the total result.

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • src/index.ts:23-41 (registration)
    Registers the 'sum' tool with MCP server, including description, input schema using Zod, and inline handler function.
    server.tool( "sum", "Add two numbers together", { a: z.number().describe("First number"), b: z.number().describe("Second number") }, async ({ a, b }: { a: number; b: number }) => { const result = a + b; return { content: [ { type: "text", text: `The sum of ${a} and ${b} is: ${result}` } ] }; } );
  • Input schema for 'sum' tool: two numbers a and b.
    { a: z.number().describe("First number"), b: z.number().describe("Second number") },
  • Handler function computes sum of a and b, returns text content with the result.
    async ({ a, b }: { a: number; b: number }) => { const result = a + b; return { content: [ { type: "text", text: `The sum of ${a} and ${b} is: ${result}` } ] }; }

Other Tools

Related Tools

  • @riteshbangal/BuildMcpServer
  • @liaotaodcx8/toolkittest
  • @GonTwVn/GonMCPtool
  • @parameshwaran1/mcpserverexample
  • @kelseyee/mcp_calculator
  • @joeguo911/mcp-demo

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/bahfahh/mcptest'

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