Skip to main content
Glama
islobodan

Crucher MCP

cosine

Read-onlyIdempotent

Calculate the cosine of an angle with optional unit specification (degrees or radians).

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
angleYes
unitNo

Implementation Reference

  • The cosine tool handler function. Computes Math.cos of the angle after converting to radians via toRadians(angle, unit).
    /**
     * 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, defining the 'angle' (number) and 'unit' (string, 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"],
        },
  • cruncher.js:136-155 (registration)
    Cosine is registered as a MAIN_THREAD_TOOL (line 140) and listed in TRIG_TOOLS (line 127) for caching. It appears in the 'standard' tool tier (line 80).
    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",
    ]);
  • The toRadians helper function used by cosine to convert angle units (degrees to radians) based on the argument's unit or the global angleMode.
    const toRadians = (angle, unit) => {
        const resolved = unit || angleMode;
        return resolved === "degrees" ? angle * (Math.PI / 180) : angle;
    };
  • The fromRadians helper function (not used by cosine directly, but related inverse trig conversions).
    const fromRadians = (radians, unit) => {
        const resolved = unit || angleMode;
        return resolved === "degrees" ? radians * (180 / Math.PI) : radians;
    };
Behavior3/5

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

Annotations already indicate readOnly, idempotent, and non-destructive behavior. The description adds minimal extra context (unit defaults) but does not detail return values, domain, or precision. With strong annotation coverage, the description adds some value but not extensive behavioral detail.

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 a single concise sentence of 10 words, front-loading the tool's identity and essential usage. No wasted words; every part 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 math tool with annotations and no output schema, the description adequately conveys unit behavior but omits explicit statement of return value (cosine result) and edge cases. It suffices for basic understanding but is not fully comprehensive.

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

Parameters3/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. It clarifies the 'unit' parameter's enum values and default behavior but does not explain the 'angle' parameter's type or constraints beyond its name. Partial compensation is provided.

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 'Cosine. Angle in degrees by default, or radians with unit: 'radians'.' clearly identifies the tool as computing the cosine of an angle. The explicit mention of unit defaults distinguishes it from similar trig functions through name and context.

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 provides guidance on unit usage (degrees default, radians with unit parameter) but offers no advice on when to use cosine versus sibling tools like sine or tangent. It lacks exclusions or alternative recommendations.

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