Skip to main content
Glama
islobodan

Crucher MCP

divide

Read-onlyIdempotent

Divides two numbers. Returns an error if the divisor is zero.

Instructions

Divides two numbers. Errors on zero divisor.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • Schema definition for the 'divide' tool: specifies input parameters 'a' (number) and 'b' (number), both required. Description: 'Divides two numbers. Errors on zero divisor.'
    {
        name: "divide",
        annotations: {
            title: "Divide",
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false,
        },
        description:
            "Divides two numbers. Errors on zero divisor.",
        inputSchema: {
            type: "object",
            properties: { a: { type: "number" }, b: { type: "number" } },
            required: ["a", "b"],
        },
    },
  • cruncher.js:66-67 (registration)
    Tool registration in the 'minimal' tier list. 'divide' is included in all three tool tiers (minimal, standard, full via null).
        "evaluate_expression", "add", "subtract", "multiply", "divide",
    ],
  • Helper function safeMath.divide: performs safe floating-point division with integer-scaling to avoid precision errors. Throws if divisor is zero.
    divide: (a, b) => {
        if (b === 0) throw new Error("Division by zero is not allowed.");
        const d1 = countDecimals(a);
        const d2 = countDecimals(b);
        const maxDecimals = Math.max(d1, d2);
        const multiplier = Math.pow(10, maxDecimals);
        return Math.round(a * multiplier) / Math.round(b * multiplier);
    },
  • Handler for the 'divide' tool in toolHandlers. Takes { a, b } and delegates to safeMath.divide(a, b).
    /**
     * Divides the first number by the second.
     * @param {Object} args - The arguments object.
     * @param {number} args.a - The numerator.
     * @param {number} args.b - The denominator.
     * @returns {number} The quotient of a and b.
     * @throws {Error} If b is zero.
     */
    divide: ({ a, b }) => safeMath.divide(a, b),
  • cruncher.js:69-80 (registration)
    Tool registration in the 'standard' tier list. 'divide' is included in standard tier as well.
    standard: [
        "evaluate_expression",
        "add", "subtract", "multiply", "divide",
        "sqrt", "power", "absolute", "modulo", "factorial",
        "logarithm", "natural_log", "get_constant",
        "sine", "cosine", "tangent", "asin", "acos", "atan",
        "set_angle_mode", "get_angle_mode",
        "sum", "avg", "min", "max", "count", "variance", "std_dev",
        "percentage_of", "percentage_change", "percentage_reverse",
        "median", "range",
        "convert_unit",
    ],
Behavior5/5

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

Annotations already declare the tool as read-only and idempotent. The description adds a critical behavioral detail: 'Errors on zero divisor', which goes beyond annotations. There is no contradiction, and the description appropriately discloses the only notable side-effect (error condition).

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 two sentences and only 11 words. The main action is front-loaded ('Divides two numbers'), and the error behavior is stated immediately. No redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple mathematical tool with clear annotations and no output schema, the description is complete. It covers the core functionality and the key error condition. The sibling tools are math operations, and the description is sufficient to distinguish it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not add meaning to the parameters beyond naming them. Specifically, it does not clarify that 'a' is the dividend and 'b' is the divisor, which is important for correct usage. The description should specify the order to avoid ambiguity.

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 clearly states the tool divides two numbers and explicitly mentions the error case for zero divisor. This directly answers what the tool does (verb: 'Divides', resource: 'two numbers') and distinguishes it from sibling tools like multiply or subtract.

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 description implies when to use (for division) but provides no explicit guidance on alternatives or when not to use. Given the variety of sibling tools, explicit guidance like 'use this to compute a/b' would improve clarity. However, the tool's purpose is straightforward.

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/islobodan/cruncher-mcp'

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