Skip to main content
Glama

add

Add two numbers together to calculate their sum. This tool performs basic arithmetic addition for numerical values.

Instructions

Add two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • The handler function for the 'add' tool that computes the sum of two numbers and returns it as text content.
    async ({ a, b }) => { const sum = a + b; return { content: [ { type: "text", text: `The sum of ${a} and ${b} is ${sum}`, }, ], }; }
  • The input schema for the 'add' tool 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)
    The registration of the 'add' tool using server.tool, including name, description, schema, and handler.
    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}`, }, ], }; } );

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