Skip to main content
Glama
islobodan

Crucher MCP

modulo

Read-onlyIdempotent

Calculates the remainder of dividing a by b. Returns an error if b is zero.

Instructions

Remainder of a / b. Errors on zero divisor.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • Schema/definition for the 'modulo' tool, including its name, description ('Remainder of a / b. Errors on zero divisor.'), and input schema requiring two number parameters (a and b).
    {
        name: "modulo",
        annotations: {
            title: "Modulo",
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false,
        },
        description:
            "Remainder of a / b. Errors on zero divisor.",
        inputSchema: {
            type: "object",
            properties: { a: { type: "number" }, b: { type: "number" } },
            required: ["a", "b"],
        },
    },
  • Handler for the 'modulo' tool. Delegates to safeMath.modulo(a, b) to compute the remainder of a divided by b.
    /** Additional Math Handlers */
    /**
     * Calculates the remainder (modulo) of dividing two numbers.
     * @param {Object} args - The arguments object.
     * @param {number} args.a - The dividend.
     * @param {number} args.b - The divisor.
     * @returns {number} The remainder of a divided by b.
     * @throws {Error} If b is zero.
     */
    modulo: ({ a, b }) => safeMath.modulo(a, b),
  • safeMath.modulo implementation: provides safe floating-point modulo using integer-scaling to avoid precision errors. Throws on zero divisor.
        modulo: (a, b) => {
            if (b === 0) throw new Error("Modulo 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)) /
                multiplier
            );
        },
    };
  • cruncher.js:76-86 (registration)
    Registration of 'modulo' in the 'standard' tool tier list, controlling which tools are exposed based on the CRUNCHER_TOOL_SET environment variable.
        "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",
    ],
Behavior3/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds the important error condition on zero divisor, but does not disclose other potential behaviors (e.g., handling of negative numbers, return value details).

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: two short sentences with no superfluous words. It front-loads the purpose and effectively communicates the key behavior.

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

Completeness4/5

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

Given the simplicity of the tool, rich annotations, and no output schema, the description covers the core operation and error case. It is mostly complete, though missing details on return type and edge cases (e.g., negative numbers) are acceptable for a basic arithmetic tool.

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 only implies the roles of 'a' and 'b' via the phrase 'remainder of a / b'. It does not provide explicit parameter semantics or constraints beyond the schema types.

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 operation ('remainder of a / b') and explicitly mentions the error condition on zero divisor, which distinguishes it from sibling tools like 'divide'.

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 does not provide explicit guidance on when to use this tool versus alternatives (e.g., 'divide', 'modulo' variants). The context is implied but not stated.

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