Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

add

Calculate the sum of two numbers by providing numeric inputs a and b.

Instructions

Add two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler function that executes the 'add' tool logic. It takes params (a, b), adds them, and returns a text result.
    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}` }] };
    },
  • The schema definition for the 'add' tool, specifying name 'add', description 'Add two numbers', and input schema with two number fields (a, b).
    schema: {
      name: "add",
      description: "Add two numbers",
      inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })),
    },
  • src/server.ts:7-9 (registration)
    Import and registration of the 'add' tool (along with others) into the tools array used by the server.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
  • src/tools/index.ts:1-1 (registration)
    Re-exports the 'add' module from the tools barrel file.
    export * from "./add";
  • The Tool interface that the 'add' constant conforms to, defining schema + handle pattern.
    export interface Tool {
      schema: ToolSchema;
      handle: (params: Record<string, unknown>) => Promise<ToolResult>;
    }
Behavior4/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. 'Add two numbers' accurately describes a pure, stateless, non-destructive operation. For such a simple arithmetic tool, this is sufficient transparency, though it could explicitly state that it has no side effects.

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 a single, front-loaded sentence that conveys the essential action without any unnecessary words. It is highly concise and structured effectively.

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

Completeness4/5

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

Given the tool's extreme simplicity (add two numbers), the description is largely complete. It could mention the return value (the sum), but that is easily inferred. The lack of output schema does not significantly degrade completeness here.

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

Parameters1/5

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

Schema description coverage is 0% – the description does not explain the two parameters 'a' and 'b' or their roles beyond what the schema already provides. With no additional meaning added, this dimension is severely lacking.

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

Purpose5/5

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

The description clearly states 'Add two numbers', specifying the verb 'add' and the resource 'two numbers'. This distinguishes it from sibling tools like sub, mul, div, mod, and sqrt, which perform different operations.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. For example, it does not explain when addition is preferred over subtraction or multiplication. The usage context is entirely implied.

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

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