Skip to main content
Glama
tech-sushant

Calculator MCP Server

by tech-sushant

add

Add two numbers together to calculate their sum. This tool performs basic addition for mathematical calculations.

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number to add
bYesSecond number to add

Implementation Reference

  • Handler for the 'add' tool: destructures arguments a and b, computes their sum, and returns a text response with the result.
    case "add": { const { a, b } = args as { a: number; b: number }; const result = a + b; return { content: [ { type: "text", text: `${a} + ${b} = ${result}`, }, ], }; }
  • Input schema defining 'a' and 'b' as required number properties for the 'add' tool.
    inputSchema: { type: "object", properties: { a: { type: "number", description: "First number to add", }, b: { type: "number", description: "Second number to add", }, }, required: ["a", "b"], },
  • src/index.ts:20-37 (registration)
    Registration of the 'add' tool in the ListTools response, including name, description, and schema.
    { name: "add", description: "Add two numbers together", inputSchema: { type: "object", properties: { a: { type: "number", description: "First number to add", }, b: { type: "number", description: "Second number to add", }, }, required: ["a", "b"], }, },
Install Server

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/tech-sushant/calculator-mcp'

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