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"],
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description must carry the behavioral burden; it clearly indicates the core operation and argument order. However, it does not disclose edge-case behavior such as division by zero or the shape of the return value, and no output schema is provided.

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?

One short sentence with no filler; every word earns its place and the core action plus operand order are front-loaded.

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?

The tool is simple and the schema fully covers parameters, so little extra is required. Still, without an output schema or mention of zero-divisor/error behavior, the agent must assume the return format and failure semantics.

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 input schema already documents both parameters at 100% coverage with descriptions 'Dividend' and 'Divisor'. The description's 'first number'/'second number' wording reinforces order but adds no semantic detail beyond the schema.

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 states a specific verb and resource: divide two numbers, with explicit operand order. The operation is immediately distinguishable from sibling tools add, subtract, and multiply.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The intended use is implied by the name and the verb 'divide', but there is no explicit statement of when to choose this over add/subtract/multiply or any exclusions. For a basic arithmetic tool this is adequate but not explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools