Skip to main content
Glama
codewithmsunke

MCP Math Server

Addition tool

add

Calculate the sum of two numbers by providing values for a and b to perform basic addition operations.

Instructions

Add two numbers a + b

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler function for the 'add' tool that adds two input numbers 'a' and 'b' and returns a text message with the result.
    async ({ a, b }) => {
      const sum = a + b;
      return {
        content: [
          { type: "text", text: `The sum of ${a} and ${b} is ${sum}` }
        ]
      };
    }
  • The tool configuration including input schema (using Zod for numbers a and b), title, and description.
    {
      title: "Addition tool",
      description: "Add two numbers a + b",
      inputSchema: { a: z.number(), b: z.number() },
    },
  • src/index.ts:14-29 (registration)
    Registers the 'add' tool on the MCP server with name, configuration (schema), and handler function.
    server.registerTool(
      "add",
      {
        title: "Addition tool",
        description: "Add two numbers a + b",
        inputSchema: { a: z.number(), b: z.number() },
      },
      async ({ a, b }) => {
        const sum = a + b;
        return {
          content: [
            { type: "text", text: `The sum of ${a} and ${b} is ${sum}` }
          ]
        };
      }
    );
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. It mentions the operation ('Add') but doesn't disclose behavioral traits like error handling for non-numeric inputs, overflow, or return format. For a tool with zero annotation coverage, this is a significant gap.

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, efficient sentence with zero waste. It's front-loaded and appropriately sized for a simple arithmetic tool, earning its place clearly.

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

Completeness3/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 (simple addition) and no output schema, the description is minimally complete but lacks details on return values or error cases. It's adequate for basic use but could be improved with more context.

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

Parameters4/5

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

The description adds meaning beyond the input schema by specifying that parameters 'a' and 'b' are numbers to be added. With 0% schema description coverage, this compensates well, though it doesn't detail constraints like integer vs. float or range limits.

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 'Add two numbers a + b' clearly states the specific verb ('Add') and resource ('two numbers'), and distinguishes it from sibling tools like subtract, multiply, and divide. It's precise and unambiguous.

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 like subtract, multiply, or divide. It states what the tool does but not when it's appropriate, leaving the agent to infer usage from the name alone.

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/codewithmsunke/MCPMathTools'

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