Skip to main content
Glama

add

Add two numbers together to calculate their sum. This tool performs basic arithmetic addition for numerical values.

Instructions

Add two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

Implementation Reference

  • The handler function for the 'add' tool that computes the sum of two numbers and returns it as text content.
    async ({ a, b }) => {
      const sum = a + b;
      return {
        content: [
          {
            type: "text",
            text: `The sum of ${a} and ${b} is ${sum}`,
          },
        ],
      };
    }
  • The input schema for the 'add' tool defining parameters 'a' and 'b' as numbers.
    {
      a: z.number().describe("First number"),
      b: z.number().describe("Second number"),
    },
  • src/index.ts:285-303 (registration)
    The registration of the 'add' tool using server.tool, including name, description, schema, and handler.
    server.tool(
      "add",
      "Add two numbers",
      {
        a: z.number().describe("First number"),
        b: z.number().describe("Second 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 full burden for behavioral disclosure. 'Add two numbers' implies a simple computation but doesn't disclose any behavioral traits like error handling, precision limits, or what happens with non-numeric inputs. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 perfectly concise at three words, front-loading the core purpose with zero waste. Every word earns its place, making it immediately understandable without unnecessary elaboration.

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 simplicity (basic arithmetic with 2 parameters, 100% schema coverage, no output schema), the description is complete enough for its intended function. However, the lack of annotations and output schema means the agent must assume behavior like return format and error handling, leaving some gaps in completeness for a tool that could have edge 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 schema description coverage is 100%, with both parameters 'a' and 'b' documented as 'First number' and 'Second number' respectively. The description 'Add two numbers' adds minimal semantic value beyond what the schema already provides, confirming the operation but not adding format details or constraints. Baseline 3 is appropriate when schema does the heavy lifting.

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 verb ('Add') and resource ('two numbers'), making the purpose immediately understandable. It's specific about the operation being performed, though it doesn't distinguish from sibling tools since this appears to be the only mathematical operation among the listed siblings.

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. There's no mention of context, prerequisites, or comparisons with other tools. The agent must infer usage purely from the name and description without any explicit guidelines.

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/virajsamarasinghe/MCP-Claude'

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