Skip to main content
Glama
tech-sushant

Calculator MCP Server

by tech-sushant

divide

Perform division operations by calculating the quotient of two numbers. Use this tool to divide any number by another, with built-in error handling for cases like division by zero.

Instructions

Divide first number by second number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesDividend (number to be divided)
bYesDivisor (number to divide by)

Implementation Reference

  • The handler for the 'divide' tool performs division of the first argument 'a' by the second 'b', handles division by zero error, and formats the response.
    case "divide": {
      const { a, b } = args as { a: number; b: number };
      if (b === 0) {
        return {
          content: [
            {
              type: "text",
              text: "Error: Division by zero is not allowed",
            },
          ],
          isError: true,
        };
      }
      const result = a / b;
      return {
        content: [
          {
            type: "text",
            text: `${a} ÷ ${b} = ${result}`,
          },
        ],
      };
    }
  • src/index.ts:74-91 (registration)
    Registration of the 'divide' tool in the list of available tools, including name, description, and input schema.
    {
      name: "divide",
      description: "Divide first number by second number",
      inputSchema: {
        type: "object",
        properties: {
          a: {
            type: "number",
            description: "Dividend (number to be divided)",
          },
          b: {
            type: "number",
            description: "Divisor (number to divide by)",
          },
        },
        required: ["a", "b"],
      },
    },
  • Input schema definition for the 'divide' tool, specifying parameters 'a' (dividend) and 'b' (divisor).
    inputSchema: {
      type: "object",
      properties: {
        a: {
          type: "number",
          description: "Dividend (number to be divided)",
        },
        b: {
          type: "number",
          description: "Divisor (number to divide by)",
        },
      },
      required: ["a", "b"],
    },
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 states the operation but fails to mention critical behaviors such as handling division by zero (e.g., errors or exceptions), output format (e.g., integer vs. float), or edge cases like negative numbers. For a mutation tool (division changes values) 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 extremely concise with a single sentence ('Divide first number by second number'), which efficiently conveys the core action without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.

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 tool's complexity (simple arithmetic but with potential errors like division by zero), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects, error handling, or output details, which are crucial for an agent to use the tool correctly. The schema handles parameters well, but overall context is insufficient.

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 parameters 'a' (Dividend) and 'b' (Divisor). The description adds no additional meaning beyond what the schema provides, as it only repeats the division concept without explaining parameter roles or constraints. Baseline 3 is appropriate since the schema adequately documents parameters, but the description doesn't enhance understanding.

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 purpose with a specific verb ('Divide') and identifies the resources involved ('first number by second number'). It distinguishes from siblings like 'add', 'multiply', and 'subtract' by specifying division. However, it doesn't explicitly mention the mathematical operation name beyond the verb, which slightly limits differentiation from other arithmetic tools.

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 'multiply' or 'subtract'. It lacks context about mathematical scenarios where division is appropriate, prerequisites (e.g., avoiding division by zero), or comparisons to sibling tools. This leaves the agent with minimal usage direction beyond the basic operation.

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/tech-sushant/calculator-mcp'

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