Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

add

Perform addition of two numbers using this tool, designed for basic mathematical operations within the Calculator MCP server. Input two numerical values to get the sum instantly.

Instructions

Add two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler function that executes the 'add' tool logic: extracts numbers a and b from params, computes their sum, and returns a formatted text response.
      handle: async (params) => {
        const a = params.a as number;
        const b = params.b as number;
        const result = a + b;
        return { content: [{ type: "text", text: `The sum of ${a} and ${b} is ${result}` }] };
      },
    };
  • Defines the tool schema including name, description, and input schema (requiring numbers a and b) converted to JSON schema via Zod.
    schema: {
      name: "add",
      description: "Add two numbers",
      inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })),
    },
  • src/server.ts:7-9 (registration)
    Imports the 'add' tool (along with others) from './tools' and registers it in the 'tools' array, which is used by the MCP server's listTools and callTool handlers.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states the basic function ('Add two numbers') without mentioning behavioral traits such as error handling (e.g., for non-numeric inputs), performance characteristics, or any side effects. This leaves significant gaps in understanding how the tool behaves beyond its core operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence ('Add two numbers') that front-loads the core purpose without any wasted words. It is appropriately sized for a simple tool and efficiently communicates the essential function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (basic arithmetic), no annotations, no output schema, and incomplete parameter documentation (0% schema coverage), the description is not complete enough. It lacks details on return values, error conditions, and behavioral context, which are necessary for an AI agent to use the tool effectively beyond trivial cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 2 parameters ('a' and 'b') with 0% schema description coverage, meaning no parameter details are documented in the schema. The description 'Add two numbers' adds minimal semantics by implying that 'a' and 'b' are numbers to be added, but it doesn't specify their roles (e.g., order, constraints) or provide any additional meaning beyond the basic operation. This partially compensates for the low schema coverage but is insufficient for full clarity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Add two numbers' clearly states the tool's function with a specific verb ('Add') and resource ('two numbers'). It distinguishes from siblings like 'sub' (subtract), 'mul' (multiply), and 'div' (divide) by specifying addition. However, it doesn't explicitly mention the sibling 'mod' (modulo), leaving slight room for improvement in sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for addition operations, but it doesn't provide explicit guidance on when to use this tool versus alternatives like 'sub' or 'mul'. There's no mention of specific contexts, exclusions, or prerequisites. The implied usage is clear from the tool name and description, but no explicit guidelines are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

  • @kylekanouse/Test-MCP---DEMO-MCP-Dev-1
  • @zhangzhefang-github/mcp-add-server
  • @YuheiNakasaka/arithmetic-mcp-server
  • @wudongjie/example-mcp-server
  • @hongsw/hello-mcp
  • @FuzzyCZX/MCP

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/wrtnlabs/calculator-mcp'

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