Skip to main content
Glama
rokibul-mist

rhino-mcp

by rokibul-mist

rhino_execute_csharp

Destructive

Execute custom RhinoCommon C# scripts inside live Rhino to automate geometry creation, modify the document, and return results through an output buffer.

Instructions

Execute RhinoCommon C# code in a live Rhino session using Roslyn.

    SAFETY: This tool runs arbitrary code with full RhinoCommon access.
    It is gated behind ``RHINO_MCP_ALLOW_CSHARP=1`` so it cannot fire
    accidentally. Set the env var only in trusted sessions.

    Globals available to the script:
    - ``doc``: the active ``RhinoDoc``
    - ``output``: a ``StringBuilder`` — call ``output.AppendLine("...")``
      to return text to the caller.

    Pre-imported namespaces: System, System.Collections.Generic,
    System.Linq, System.Text, Rhino, Rhino.Geometry, Rhino.DocObjects,
    Rhino.Commands. Pass ``references`` to load extra assemblies (e.g.
    ``Grasshopper``).

    Example — create a sphere::

        var sphere = new Sphere(Point3d.Origin, 5.0);
        doc.Objects.AddBrep(sphere.ToBrep());
        doc.Views.Redraw();
        output.AppendLine("Created sphere");

    Changes are wrapped in an undo record. ``timeout_s`` caps total
    execution time (default 30s); on timeout the call returns
    ``success: false`` and the script is best-effort cancelled.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.1/5.0
Behavior5/5

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

Beyond the destructiveHint annotation, the description discloses critical behavioral traits: it runs arbitrary code with full RhinoCommon access, is gated behind an environment variable, wraps changes in an undo record, and specifies timeout behavior (returns success:false and best-effort cancellation). This goes well beyond the annotation and sets clear expectations for safety and side effects.

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 detailed but well-structured, with clear sections for safety, globals, namespaces, references, example, and timeout. It is appropriately lengthy given the tool's complexity and the need to convey safety and usage nuances. It is front-loaded with the core purpose and safety warning, making it easy to scan.

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?

The description covers key operational aspects: globals, namespaces, references, example, timeout behavior, and undo wrapping. Since an output schema exists, return values are not required in the description. It does not explicitly mention compilation error handling or how to access the output StringBuilder beyond the example, but these are minor gaps given the overall completeness.

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?

The input schema already provides descriptions for all parameters (code, timeout_s, references), covering their meaning and defaults. The tool description adds some context, such as the example and explanation of Assembly.Load for references, but does not substantially enhance parameter understanding beyond the schema. Since schema coverage is high, the baseline of 3 is appropriate.

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's purpose: 'Execute RhinoCommon C# code in a live Rhino session using Roslyn.' It specifies the action (execute), the resource (RhinoCommon C# code), and the context (live Rhino session). This unambiguously distinguishes it from other Rhino tools that perform specific geometry or document operations.

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 implies usage for custom C# scripting but does not explicitly state when to use this tool versus alternatives like rhino_execute_python. It provides detailed operational guidance (safety, globals, timeout) but lacks an explicit 'use this when...' or comparison to other execution tools. The usage context is implied rather than 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