Skip to main content
Glama
bahfahh

Basic Math MCP Server

sum

Add two numbers together to calculate their total. Input two numeric values to perform basic addition.

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • The handler function for the 'sum' tool that adds two numbers and returns a text response.
    async ({ a, b }: { a: number; b: number }) => { const result = a + b; return { content: [ { type: "text", text: `The sum of ${a} and ${b} is: ${result}` } ] }; }
  • Zod schema defining input parameters 'a' and 'b' as numbers for the 'sum' tool.
    a: z.number().describe("First number"), b: z.number().describe("Second number") },
  • src/index.ts:23-41 (registration)
    Registration of the 'sum' tool on the MCP server with name, description, input schema, and 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}` } ] }; } );

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

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