Skip to main content
Glama

add

Add two numbers together using the Math-MCP server’s API, enabling accurate numerical calculations for LLMs by processing defined input values.

Instructions

Adds two numbers together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNumberYesThe first addend
secondNumberYesThe second addend

Implementation Reference

  • src/index.ts:26-38 (registration)
    Registration of the 'add' tool including description, input schema using Zod, and the handler function that delegates to Arithmetic.add and formats the response.
    mathServer.tool("add", "Adds two numbers together", {
        firstNumber: z.number().describe("The first addend"),
        secondNumber: z.number().describe("The second addend")
    }, async ({ firstNumber, secondNumber }) => {
        const value = Arithmetic.add(firstNumber, secondNumber)
    
        return {
            content: [{
                type: "text",
                text: `${value}`
            }]
        }
    })
  • The handler function for the 'add' tool, which performs the addition via Arithmetic.add and returns a text response.
    }, async ({ firstNumber, secondNumber }) => {
        const value = Arithmetic.add(firstNumber, secondNumber)
    
        return {
            content: [{
                type: "text",
                text: `${value}`
            }]
        }
    })
  • Zod schema defining the input parameters for the 'add' tool: two numbers.
    firstNumber: z.number().describe("The first addend"),
    secondNumber: z.number().describe("The second addend")
  • Arithmetic.add static method implementing the core addition logic.
    static add(firstNumber: number, secondNumber: number): number {
        const sum = firstNumber + secondNumber;
        return 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 of behavioral disclosure. It only states the basic function without mentioning error handling, performance characteristics, or any constraints like input limits or precision issues. This is inadequate for a tool with no annotation coverage.

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 that directly states the tool's purpose. There's no wasted language or unnecessary elaboration, making it efficient and front-loaded for quick understanding.

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 lack of annotations and output schema, the description is too minimal. It doesn't explain the return value (e.g., the sum as a number) or address potential issues like overflow, which is insufficient for a mathematical operation tool in a context with multiple sibling alternatives.

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 schema description coverage is 100%, with clear descriptions for both parameters ('first addend', 'second addend'). The description doesn't add any semantic details beyond what the schema provides, such as examples or edge cases, so it meets the baseline for high schema coverage.

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 clearly states the tool's function as 'Adds two numbers together', which is a specific verb+resource combination. However, it doesn't distinguish this from sibling tools like 'sum' or 'multiply', which also perform mathematical operations on numbers, so it doesn't fully differentiate from alternatives.

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 'sum' (which might handle multiple numbers) or other arithmetic operations. There's no mention of use cases, prerequisites, or exclusions, leaving the agent without context for tool selection.

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

  • @zhangzhefang-github/mcp-add-server
  • @wrtnlabs/calculator-mcp
  • @YuheiNakasaka/arithmetic-mcp-server
  • @EthanHenrickson/math-mcp
  • @FuzzyCZX/MCP
  • @wudongjie/example-mcp-server

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/EthanHenrickson/math-mcp'

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