Skip to main content
Glama

calculate-sum

Add two numbers together to get their total sum. This tool performs basic arithmetic addition for any numerical inputs.

Instructions

Calculates the sum of two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesThe first number
bYesThe second number

Implementation Reference

  • The handler function that executes the core logic of the 'calculate-sum' tool by adding the two input numbers and returning the result as text content.
    handler: async ({ a, b }: { a: number; b: number }) => { return { content: [ { type: "text" as const, text: String(a + b), }, ], }; },
  • The Zod schema defining the input parameters 'a' and 'b' as numbers for the 'calculate-sum' tool.
    inputSchema: z.object({ a: z.number().describe("The first number"), b: z.number().describe("The second number"), }),
  • src/tools.ts:4-20 (registration)
    The registration of the 'calculate-sum' tool within the exported TOOLS object, which is used by the MCP server's listTools and callTool handlers.
    "calculate-sum": { description: "Calculates the sum of two numbers", inputSchema: z.object({ a: z.number().describe("The first number"), b: z.number().describe("The second number"), }), handler: async ({ a, b }: { a: number; b: number }) => { return { content: [ { type: "text" as const, text: String(a + b), }, ], }; }, },

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/v4lheru/generic-mcp-template'

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