Skip to main content
Glama
islobodan

Crucher MCP

modulo

Read-onlyIdempotent

Calculate the remainder of a divided 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

  • The 'modulo' tool handler in the toolHandlers object. Delegates to safeMath.modulo(a, b).
    modulo: ({ a, b }) => safeMath.modulo(a, b),
  • The safeMath.modulo helper function implementing the modulo logic with safe floating-point arithmetic via integer-scaling.
        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
            );
        },
    };
  • The 'modulo' tool definition in the master tools list, including inputSchema (a: number, b: number), description, and annotations.
    // --- Additional Math Functions ---
    {
        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"],
        },
    },
  • cruncher.js:69-73 (registration)
    The 'modulo' tool is registered in the 'standard' tier of the TOOL_TIERS configuration.
    standard: [
        "evaluate_expression",
        "add", "subtract", "multiply", "divide",
        "sqrt", "power", "absolute", "modulo", "factorial",
        "logarithm", "natural_log", "get_constant",
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true. The description adds the key behavioral detail 'Errors on zero divisor', which goes beyond annotations and is critical for safe use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with no wasted words. It front-loads the purpose and adds a warning. Slight improvement could include specifying the return type, but it earns its place.

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?

For a simple arithmetic tool with no output schema and 0% parameter descriptions, the description covers basic purpose and an error condition. However, it lacks details on return type, integer vs float handling, and behavior for negative numbers, leaving some ambiguity.

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%, so the description must compensate. However, it does not explain the parameters individually (e.g., whether a/b must be integers, range constraints, or behavior with negative numbers), adding minimal value 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 clearly states the tool computes the remainder of division ('Remainder of a / b') and includes a warning about zero divisors, which distinguishes it from sibling arithmetic operations like divide or power.

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 modulo over alternatives (e.g., when you need a remainder vs quotient). Usage context is implied by the operation name but not explicitly 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