Skip to main content
Glama

addition tool

add

Add two numbers together using structured input. This arithmetic tool calculates the sum of provided numerical values.

Instructions

Add two numbers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesThe first number to add.
bYesThe second number to add.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'add' tool that takes two numbers a and b, computes their sum, and returns it in both text and structured content.
    async ({ a, b }: { a: number; b: number }) => {
      const output = { result: a + b };
    
      return {
        content: [{ type: "text", text: JSON.stringify(output) }],
        structuredContent: output,
      };
    }
  • Schema definition for the 'add' tool, including title, description, input schema (a and b as numbers), and output schema (result as number).
    {
      title: "addition tool",
      description: "Add two numbers.",
      inputSchema: {
        a: z.number().describe("The first number to add."),
        b: z.number().describe("The second number to add."),
      },
      outputSchema: { result: z.number() },
    },
  • Registration of the 'add' tool using server.registerTool with name, schema, and handler.
    server.registerTool(
      "add",
      {
        title: "addition tool",
        description: "Add two numbers.",
        inputSchema: {
          a: z.number().describe("The first number to add."),
          b: z.number().describe("The second number to add."),
        },
        outputSchema: { result: z.number() },
      },
      async ({ a, b }: { a: number; b: number }) => {
        const output = { result: a + b };
    
        return {
          content: [{ type: "text", text: JSON.stringify(output) }],
          structuredContent: output,
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Add two numbers' implies a mathematical operation but reveals nothing about error handling, precision limits, rate limits, authentication needs, or return format. For a tool with zero annotation coverage, this is insufficient behavioral context.

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 just three words ('Add two numbers'). It's front-loaded with the core functionality and contains zero wasted words. Every element earns its place, making it maximally efficient.

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), 100% schema coverage, and the presence of an output schema (which handles return values), the description is minimally adequate. However, it lacks context about behavioral traits, error conditions, or usage scenarios that would be helpful despite the structured data.

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') fully documented in the schema. The description adds no additional parameter semantics beyond what the schema already provides. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even with no parameter info in the description.

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's unambiguous about what the tool does. However, with no sibling tools mentioned, there's no opportunity to distinguish from alternatives, preventing a perfect score of 5.

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, prerequisites, or contextual constraints. It simply states what the tool does without any usage instructions. This is minimal guidance, scoring above 1 only because it's not misleading.

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/sadjad-chrono/mcp-learning'

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