Skip to main content
Glama

calculate_sum

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

Instructions

Add two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler logic for the 'calculate_sum' tool within the CallToolRequestSchema handler. It validates input arguments 'a' and 'b' as numbers and returns their sum as toolResult.
    if (request.params.name === "calculate_sum") { const args = request.params.arguments as { a: number; b: number }; if (typeof args?.a !== 'number' || typeof args?.b !== 'number') { throw new McpError(ErrorCode.InvalidRequest, "Arguments 'a' and 'b' must be numbers"); } return { toolResult: args.a + args.b} ; }
  • Input schema definition for the 'calculate_sum' tool, specifying an object with required number properties 'a' and 'b'.
    inputSchema: { type: "object", properties: { a: { type: "number" }, b: { type: "number" } }, required: ["a", "b"] }
  • src/index.ts:25-35 (registration)
    Registration of the 'calculate_sum' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    name: "calculate_sum", description: "Add two numbers together", inputSchema: { type: "object", properties: { a: { type: "number" }, b: { type: "number" } }, required: ["a", "b"] } },
Install Server

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/psaboia/mcp-server-playground'

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