Skip to main content
Glama
Mtar786
by Mtar786

add

Add two numbers together to calculate their sum. Use this tool to perform basic arithmetic addition operations.

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • index.js:33-38 (handler)
    Handler function for the 'add' tool. It takes two numbers 'a' and 'b', computes their sum, and returns it as a text content block.
    async ({ a, b }) => { const sum = a + b; return { content: [{ type: "text", text: String(sum) }], }; }
  • Input schema for the 'add' tool, defining parameters 'a' and 'b' as numbers using Zod.
    { a: z.number(), b: z.number() },
  • index.js:29-39 (registration)
    Registration of the 'add' tool using McpServer.tool(), including name, description, input schema, and handler function.
    server.tool( "add", "Add two numbers together", { a: z.number(), b: z.number() }, async ({ a, b }) => { const sum = a + b; return { content: [{ type: "text", text: String(sum) }], }; } );

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/Mtar786/mcpServer'

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