Skip to main content
Glama

calculate-sum

Add two numbers together to get their total sum. This tool performs basic arithmetic addition for any numeric values provided.

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 calculate-sum tool logic: sums two input numbers and returns the result as MCP content.
    handler: async ({ a, b }: { a: number; b: number }) => { return { content: [ { type: "text" as const, text: String(a + b), }, ], }; },
  • Zod input schema defining 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 complete tool definition object for 'calculate-sum' exported in TOOLS, which is used by the MCP server for listing and calling the tool.
    "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