Skip to main content
Glama
islobodan

Crucher MCP

cosine

Read-onlyIdempotent

Compute the cosine of an angle in degrees or radians for mathematical calculations.

Instructions

Cosine. Angle in degrees by default, or radians with unit: "radians".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
angleYes
unitNo

Implementation Reference

  • The actual handler function for the 'cosine' tool. It takes angle and optional unit, converts the angle to radians via toRadians(), and computes Math.cos(). Runs synchronously on the main thread.
    /**
     * Calculates the cosine of an angle.
     * @param {Object} args - The arguments object.
     * @param {number} args.angle - The angle value.
     * @param {string} [args.unit] - The unit ("degrees" or "radians").
     * @returns {number} The cosine of the angle.
     */
    cosine: ({ angle, unit }) => Math.cos(toRadians(angle, unit)),
  • The input schema definition for the 'cosine' tool. It defines the 'angle' (number, required) and 'unit' (optional, enum: degrees/radians) parameters.
    {
        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"],
        },
  • The toRadians helper function used by the cosine handler. It converts an angle from degrees to radians if the resolved unit is 'degrees', otherwise passes through unchanged. Defaults to the global angleMode variable.
     */
    const toRadians = (angle, unit) => {
        const resolved = unit || angleMode;
        return resolved === "degrees" ? angle * (Math.PI / 180) : angle;
    };
  • cruncher.js:63-74 (registration)
    The 'cosine' tool is registered in the TOOL_TIERS.standard array (line 74), making it available in the standard and full tool sets.
    const TOOL_TIERS = {
        // 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",
Behavior4/5

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

Annotations already provide readOnlyHint, destructiveHint, and idempotentHint. The description adds that angle is in degrees by default and unit changes to radians, which is beyond annotations. Does not disclose edge cases like NaN for invalid inputs.

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?

One short sentence that is front-loaded with the function name and immediately clarifies unit behavior. Every word earns its place; no extraneous information.

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?

Given the tool's simplicity and rich annotations, the description is adequate but misses return range ([-1,1]) or error behavior. Without an output schema, some hint about return type would improve completeness.

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

Parameters4/5

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

With 0% schema coverage, the description effectively explains that 'angle' is numeric and its unit defaults to degrees, and 'unit' accepts 'radians' to switch. This adds meaning beyond the schema's enum, though it could mention the angle range or constraints.

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 states 'Cosine' and explains default unit (degrees) and how to use radians. It clearly identifies the mathematical operation, but fails to distinguish from sibling trig functions like sine or tangent, which could be ambiguous.

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 on when to use this tool versus alternatives like sine or tangent. Only mentions unit behavior, not context or prerequisites for using cosine.

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