Skip to main content
Glama

add

Calculate the sum of two numbers by providing both values as input parameters.

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • The handler function for the 'add' tool that adds two input numbers and returns the result as text content.
    async ({ a, b }) => ({ content: [ { type: "text", text: `${a} + ${b} = ${a + b}` } ] })
  • Input schema, title, and description for the 'add' tool using Zod validation.
    { title: "Addition Tool", description: "Add two numbers together", inputSchema: { a: z.number().describe("First number"), b: z.number().describe("Second number") } },
  • Registration of the 'add' tool on the MCP server, including schema and inline handler function.
    server.registerTool( "add", { title: "Addition Tool", description: "Add two numbers together", inputSchema: { a: z.number().describe("First number"), b: z.number().describe("Second number") } }, async ({ a, b }) => ({ content: [ { type: "text", text: `${a} + ${b} = ${a + b}` } ] }) );

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/kylekanouse/Test-MCP---DEMO-MCP-Dev-1'

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