Skip to main content
Glama
islobodan

Crucher MCP

sqrt

Read-onlyIdempotent

Computes the square root of a number. Returns an error for negative values.

Instructions

Square root. Errors on negative input.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYes

Implementation Reference

  • The sqrt tool handler function. It validates the input is non-negative and returns Math.sqrt(value).
    sqrt: ({ value }) => {
        if (value < 0)
            throw new Error(
                "Cannot calculate the square root of a negative number.",
            );
        return Math.sqrt(value);
    },
  • The sqrt tool schema definition including name, annotations, description, and inputSchema requiring a numeric 'value' property.
    {
        name: "sqrt",
        annotations: {
            title: "Square Root",
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false,
        },
        description:
            "Square root. Errors on negative input.",
        inputSchema: {
            type: "object",
            properties: { value: { type: "number" } },
            required: ["value"],
        },
    },
  • cruncher.js:227-1042 (registration)
    The 'toolsAll' array containing the master catalog of all tools including sqrt. Filtered at startup via CRUNCHER_TOOL_SET.
    const toolsAll = [
        // --- Basic Arithmetic (use evaluate_expression for complex math) ---
        {
            name: "add",
            annotations: {
                title: "Add",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Adds two numbers.",
            inputSchema: {
                type: "object",
                properties: { a: { type: "number" }, b: { type: "number" } },
                required: ["a", "b"],
            },
        },
        {
            name: "subtract",
            annotations: {
                title: "Subtract",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Subtracts two numbers.",
            inputSchema: {
                type: "object",
                properties: { a: { type: "number" }, b: { type: "number" } },
                required: ["a", "b"],
            },
        },
        {
            name: "multiply",
            annotations: {
                title: "Multiply",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Multiplies two numbers.",
            inputSchema: {
                type: "object",
                properties: { a: { type: "number" }, b: { type: "number" } },
                required: ["a", "b"],
            },
        },
        {
            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"],
            },
        },
        // --- Power & Root ---
        {
            name: "power",
            annotations: {
                title: "Power",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Raises a to the power of b.",
            inputSchema: {
                type: "object",
                properties: {
                    base: { type: "number" },
                    exponent: { type: "number" },
                },
                required: ["base", "exponent"],
            },
        },
        {
            name: "sqrt",
            annotations: {
                title: "Square Root",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Square root. Errors on negative input.",
            inputSchema: {
                type: "object",
                properties: { value: { type: "number" } },
                required: ["value"],
            },
        },
        // --- Trigonometry ---
        {
            name: "sine",
            annotations: {
                title: "Sine",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                'Sine. Angle in degrees by default, or radians with unit: "radians".',
            inputSchema: {
                type: "object",
                properties: {
                    angle: { type: "number" },
                    unit: { type: "string", enum: ["degrees", "radians"] },
                },
                required: ["angle"],
            },
        },
        {
            name: "cosine",
            annotations: {
                title: "Cosine",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                'Cosine. Angle in degrees by default, or radians with unit: "radians".',
            inputSchema: {
                type: "object",
                properties: {
                    angle: { type: "number" },
                    unit: { type: "string", enum: ["degrees", "radians"] },
                },
                required: ["angle"],
            },
        },
        {
            name: "tangent",
            annotations: {
                title: "Tangent",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                'Tangent. Angle in degrees by default, or radians with unit: "radians".',
            inputSchema: {
                type: "object",
                properties: {
                    angle: { type: "number" },
                    unit: { type: "string", enum: ["degrees", "radians"] },
                },
                required: ["angle"],
            },
        },
        // --- Inverse Trigonometry (added in v1.1.0) ---
        {
            name: "asin",
            annotations: {
                title: "Arcsine",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                'Arcsine. Result in degrees by default, or radians with unit param.',
            inputSchema: {
                type: "object",
                properties: {
                    value: { type: "number" },
                    unit: { type: "string", enum: ["degrees", "radians"] },
                },
                required: ["value"],
            },
        },
        {
            name: "acos",
            annotations: {
                title: "Arccosine",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                'Arccosine. Result in degrees by default, or radians with unit param.',
            inputSchema: {
                type: "object",
                properties: {
                    value: { type: "number" },
                    unit: { type: "string", enum: ["degrees", "radians"] },
                },
                required: ["value"],
            },
        },
        {
            name: "atan",
            annotations: {
                title: "Arctangent",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                'Arctangent. Result in degrees by default, or radians with unit param.',
            inputSchema: {
                type: "object",
                properties: {
                    value: { type: "number" },
                    unit: { type: "string", enum: ["degrees", "radians"] },
                },
                required: ["value"],
            },
        },
        // --- Logarithms ---
        {
            name: "logarithm",
            annotations: {
                title: "Logarithm",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Base-10 logarithm. Errors on non-positive input.",
            inputSchema: {
                type: "object",
                properties: { value: { type: "number" } },
                required: ["value"],
            },
        },
        {
            name: "natural_log",
            annotations: {
                title: "Natural Logarithm",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Natural logarithm (ln). Errors on non-positive input.",
            inputSchema: {
                type: "object",
                properties: { value: { type: "number" } },
                required: ["value"],
            },
        },
        // --- Other ---
        {
            name: "absolute",
            annotations: {
                title: "Absolute Value",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Absolute value.",
            inputSchema: {
                type: "object",
                properties: { value: { type: "number" } },
                required: ["value"],
            },
        },
        // --- Constants ---
        {
            name: "get_constant",
            annotations: {
                title: "Get Constant",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Returns a mathematical, physical, or chemical constant. See enum values.",
            inputSchema: {
                type: "object",
                properties: {
                    name: {
                        type: "string",
                        enum: [
                            "pi",
                            "e",
                            "tau",
                            "phi",
                            "sqrt2",
                            "euler_mascheroni",
                            "c",
                            "g",
                            "G",
                            "h",
                            "k",
                            "R",
                            "NA",
                            "e_charge",
                            "m_e",
                            "m_p",
                        ],
                    },
                },
                required: ["name"],
            },
        },
        // --- Statistical Functions (added in v1.1.0) ---
        {
            name: "sum",
            annotations: {
                title: "Sum",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Sum of numbers.",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                },
                required: ["numbers"],
            },
        },
        {
            name: "avg",
            annotations: {
                title: "Average",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Average (mean) of numbers.",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                },
                required: ["numbers"],
            },
        },
        {
            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"],
            },
        },
        {
            name: "min",
            annotations: {
                title: "Minimum",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Minimum of numbers.",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                },
                required: ["numbers"],
            },
        },
        {
            name: "max",
            annotations: {
                title: "Maximum",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Maximum of numbers.",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                },
                required: ["numbers"],
            },
        },
        // --- Memory Functions ---
        {
            name: "memory_clear",
            annotations: {
                title: "Memory Clear",
                readOnlyHint: false,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Clear memory (MC).",
            inputSchema: { type: "object", properties: {} },
        },
        {
            name: "memory_recall",
            annotations: {
                title: "Memory Recall",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: false,
                openWorldHint: false,
            },
            description: "Recall memory value (MR).",
            inputSchema: { type: "object", properties: {} },
        },
        {
            name: "memory_add",
            annotations: {
                title: "Memory Add",
                readOnlyHint: false,
                destructiveHint: false,
                idempotentHint: false,
                openWorldHint: false,
            },
            description: "Add to memory (M+).",
            inputSchema: {
                type: "object",
                properties: { value: { type: "number" } },
                required: ["value"],
            },
        },
        {
            name: "memory_subtract",
            annotations: {
                title: "Memory Subtract",
                readOnlyHint: false,
                destructiveHint: false,
                idempotentHint: false,
                openWorldHint: false,
            },
            description: "Subtract from memory (M-).",
            inputSchema: {
                type: "object",
                properties: { value: { type: "number" } },
                required: ["value"],
            },
        },
        // --- Additional Statistical Functions ---
        {
            name: "count",
            annotations: {
                title: "Count",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Count elements.",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                },
                required: ["numbers"],
            },
        },
        {
            name: "range",
            annotations: {
                title: "Range",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Range (max - min) of numbers.",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                },
                required: ["numbers"],
            },
        },
        {
            name: "percentile",
            annotations: {
                title: "Percentile",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Percentile (0-100) of numbers.",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                    percentile: { type: "number", minimum: 0, maximum: 100 },
                    timeout: { type: "number", minimum: 100, maximum: 60000, description: "Custom timeout in ms (100-60000, default: 3000)" },
                },
                required: ["numbers", "percentile"],
            },
        },
        {
            name: "variance",
            annotations: {
                title: "Variance",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Sample variance (n-1). Set population: true for population variance (n).",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                    population: { type: "boolean" },
                },
                required: ["numbers"],
            },
        },
        {
            name: "std_dev",
            annotations: {
                title: "Standard Deviation",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Sample standard deviation (n-1). Set population: true for population (n).",
            inputSchema: {
                type: "object",
                properties: {
                    numbers: { type: "array", items: { type: "number" } },
                    population: { type: "boolean" },
                },
                required: ["numbers"],
            },
        },
        // --- Percentage Functions ---
        {
            name: "percentage_of",
            annotations: {
                title: "Percentage Of",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "What is X% of Y? e.g., 15% of 200 = 30",
            inputSchema: {
                type: "object",
                properties: {
                    percent: { type: "number" },
                    total: { type: "number" },
                },
                required: ["percent", "total"],
            },
        },
        {
            name: "percentage_change",
            annotations: {
                title: "Percentage Change",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Percentage change from A to B. e.g., 50→80 = +60%",
            inputSchema: {
                type: "object",
                properties: {
                    from: { type: "number" },
                    to: { type: "number" },
                },
                required: ["from", "to"],
            },
        },
        {
            name: "percentage_reverse",
            annotations: {
                title: "Percentage Reverse",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "X is Y% of what? e.g., 30 is 15% of 200",
            inputSchema: {
                type: "object",
                properties: {
                    value: { type: "number" },
                    percent: { type: "number" },
                },
                required: ["value", "percent"],
            },
        },
        // --- 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"],
            },
        },
        {
            name: "factorial",
            annotations: {
                title: "Factorial",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Factorial of non-negative integer (n!). n > 170 overflows.",
            inputSchema: {
                type: "object",
                properties: {
                    n: { type: "number" },
                    timeout: { type: "number", minimum: 100, maximum: 60000, description: "Custom timeout in ms (100-60000, default: 3000)" },
                },
                required: ["n"],
            },
        },
        // --- NEW in v1.2.0: Expression Evaluator ---
        {
            name: "evaluate_expression",
            annotations: {
                title: "Evaluate Expression",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Evaluate a mathematical expression. PRIMARY tool for ALL math: +, -, *, /, %, ^. Functions: sqrt, sin, cos, tan, asin, acos, atan, log10, ln, log(x,base), abs, round, floor, ceil, min, max. Constants: pi, e, tau, phi, sqrt2, euler_mascheroni, c, g, G, h, k, R, NA, e_charge, m_e, m_p. Parentheses and scientific notation (1e6) supported. Use explicit operators: 2 * pi, not 2pi.",
            inputSchema: {
                type: "object",
                properties: { expression: { type: "string" } },
                required: ["expression"],
            },
        },
        {
            name: "convert_base",
            annotations: {
                title: "Convert Base",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Convert number string between bases 2, 8, 10, 16.",
            inputSchema: {
                type: "object",
                properties: {
                    value: { type: "string" },
                    from_base: { type: "number", enum: [2, 8, 10, 16] },
                    to_base: { type: "number", enum: [2, 8, 10, 16] },
                },
                required: ["value", "from_base", "to_base"],
            },
        },
        {
            name: "convert_unit",
            annotations: {
                title: "Convert Unit",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description:
                "Convert between common units. Categories: length, weight, temperature, area, volume, time, speed, digital_storage.",
            inputSchema: {
                type: "object",
                properties: {
                    value: { type: "number" },
                    category: {
                        type: "string",
                        enum: ["length", "weight", "temperature", "area", "volume", "time", "speed", "digital_storage"],
                    },
                    from: { type: "string" },
                    to: { type: "string" },
                },
                required: ["value", "category", "from", "to"],
            },
        },
        {
            name: "batch",
            annotations: {
                title: "Batch",
                readOnlyHint: false,
                destructiveHint: false,
                idempotentHint: false,
                openWorldHint: false,
            },
            description:
                "Execute multiple tool calls sequentially. Returns array of results.",
            inputSchema: {
                type: "object",
                properties: {
                    operations: {
                        type: "array",
                        items: {
                            type: "object",
                            properties: {
                                tool: { type: "string" },
                                args: { type: "object" },
                            },
                            required: ["tool", "args"],
                        },
                    },
                },
                required: ["operations"],
            },
        },
        {
            name: "set_angle_mode",
            annotations: {
                title: "Set Angle Mode",
                readOnlyHint: false,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Set global trig angle mode. Individual calls with unit param override this.",
            inputSchema: {
                type: "object",
                properties: {
                    mode: { type: "string", enum: ["degrees", "radians"] }
                },
                required: ["mode"]
            }
        },
        {
            name: "get_angle_mode",
            annotations: {
                title: "Get Angle Mode",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Get current trig angle mode.",
            inputSchema: { type: "object", properties: {}, required: [] }
        },
        {
            name: "cache_clear",
            annotations: {
                title: "Cache Clear",
                readOnlyHint: false,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Clear computation cache.",
            inputSchema: { type: "object", properties: {}, required: [] },
        },
        {
            name: "cache_info",
            annotations: {
                title: "Cache Info",
                readOnlyHint: true,
                destructiveHint: false,
                idempotentHint: true,
                openWorldHint: false,
            },
            description: "Show cache stats.",
            inputSchema: { type: "object", properties: {}, required: [] },
        },
    ];
  • cruncher.js:64-83 (registration)
    Tool set tier configuration. 'sqrt' is included in the 'standard' tier (line 72) and implicitly in 'full' (null = all tools).
        // Minimal: math primitives + evaluate_expression (5 tools)
        minimal: [
            "evaluate_expression", "add", "subtract", "multiply", "divide",
        ],
        // Standard: core math + trig, common stats, constants, unit conversion (34 tools)
        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",
        ],
        // Full: standard + base conversion, advanced stats, memory ops, admin tools
        full: null,
    };
  • cruncher.js:130-149 (registration)
    MAIN_THREAD_TOOLS set marking 'sqrt' (line 142) as an instant tool that runs on the main thread without worker overhead.
    const MAIN_THREAD_TOOLS = new Set([
        // Angle management
        "set_angle_mode", "get_angle_mode",
        // Trigonometry (instant Math calls)
        "sine", "cosine", "tangent", "asin", "acos", "atan",
        // Cache management
        "cache_clear", "cache_info",
        // Simple stats (zero-cost)
        "count", "min", "max", "variance", "std_dev",
        // Percentage
        "percentage_of", "percentage_change", "percentage_reverse",
        // Math one-liners
        "power", "sqrt", "logarithm", "natural_log", "absolute",
        // Constant lookup
        "get_constant",
        // Memory recall (single variable read)
        "memory_recall",
        // Unit conversion
        "convert_unit",
    ]);
Behavior4/5

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

Annotations already declare readOnlyHint, destructiveHint, and idempotentHint. The description adds a key behavioral detail: the tool errors on negative input, which goes beyond the annotation defaults.

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, front-loaded with the purpose. No extraneous words, every sentence adds value.

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 low complexity (one parameter, no output schema), the description covers the essential behavior and a key error condition. It could mention the return type (non-negative number) for complete transparency, but it is largely sufficient.

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%, meaning the description must compensate. However, it adds no additional meaning about the 'value' parameter beyond what the schema and tool name imply. The parameter is self-explanatory, but the description fails to clarify any nuances.

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 'Square root', which is a specific mathematical operation. It clearly distinguishes from sibling tools like absolute, cosine, etc., by naming the exact function.

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 mentions 'Errors on negative input', giving a clear constraint on when not to use it. However, it does not provide guidance on when to prefer this tool over alternatives like power (with exponent 0.5) or other methods.

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