Skip to main content
Glama
islobodan

Crucher MCP

median

Read-onlyIdempotent

Calculate the middle value from a set of numbers. Provide an array of numbers to get the central value.

Instructions

Median of numbers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numbersYes
timeoutNoCustom timeout in ms (100-60000, default: 3000)

Implementation Reference

  • The function that executes the median tool logic: sorts numbers and returns the middle value (or average of two middle values for even-length arrays).
    /**
     * Calculates the median of an array of numbers.
     * @param {Object} args - The arguments object.
     * @param {number[]} args.numbers - Array of numbers.
     * @returns {number} The median value.
     * @throws {Error} If the array is empty.
     */
    median: ({ numbers }) => {
        if (numbers.length === 0)
            throw new Error("Cannot calculate the median of an empty list.");
        const sorted = [...numbers].sort((a, b) => a - b);
        const mid = Math.floor(sorted.length / 2);
        return sorted.length % 2 === 0
            ? (sorted[mid - 1] + sorted[mid]) / 2
            : sorted[mid];
    },
  • Input schema for the median tool: requires an array of numbers, with optional custom timeout parameter.
    {
        name: "median",
        annotations: {
            title: "Median",
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false,
        },
        description: "Median of numbers.",
        inputSchema: {
            type: "object",
            properties: {
                numbers: { type: "array", items: { type: "number" } },
                timeout: { type: "number", minimum: 100, maximum: 60000, description: "Custom timeout in ms (100-60000, default: 3000)" },
            },
            required: ["numbers"],
        },
    },
  • cruncher.js:69-79 (registration)
    Registration of 'median' in the standard tool tier, which is the default tool set.
    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",
  • The median tool is listed in TIMEOUT_TOOLS, meaning it supports a custom timeout parameter and runs in a worker thread.
    const TIMEOUT_TOOLS = new Set(["factorial", "median", "percentile"]);
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, covering safety and idempotency. The description adds no additional behavioral context (e.g., handling empty arrays, sort behavior), so it does not enhance transparency beyond the annotations.

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 at one sentence, which is efficient for a simple operation. However, it lacks structured details like bullet points or context, reducing its informative value.

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 no output schema, the description does not explain the return type or value. It omits behavior for even-length arrays, empty arrays, and error handling, leaving the agent with incomplete understanding for a 2-parameter 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 50% (only timeout has a description). The tool description does not clarify the 'numbers' parameter (e.g., must be non-empty, allows NaN, duplicates). It adds minimal value beyond the schema.

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 'Median of numbers' clearly states the tool computes the median of input numbers, distinguishing it from siblings like average or sum. However, it lacks detail on how the median is calculated (e.g., sorting, handling even counts).

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?

No guidance is provided on when to use this tool versus alternatives. There is no mention of prerequisites, edge cases, or when not to use it.

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