Skip to main content
Glama

rhino_execute_csharp

Destructive

Run RhinoCommon C# scripts in a live Rhino session. Automate geometry creation, modification, and analysis with full access to Rhino document and objects.

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

Behavior5/5

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

Annotations only provide destructiveHint=true. The description goes far beyond: it details the safety gating, available globals (doc, output), pre-imported namespaces, undo record wrapping, and timeout behavior. This provides essential behavioral context that annotations do not cover.

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 well-structured with clear sections (safety, globals, pre-imports, example, behavior). Each sentence serves a purpose, and the key action is front-loaded. It is appropriately sized for a complex tool, avoiding unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a code execution tool, this description covers all essential aspects: what the tool does, how to use it (with examples), safety considerations, available variables, undo behavior, timeout handling, and output mechanism. Given the tool's complexity and the presence of an output schema (not shown but referenced), this is a complete and helpful description.

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

Parameters5/5

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

The input schema provides brief descriptions for each parameter, but the description adds significant value: it explains the code parameter through an example and details the globals and namespaces available. It also elaborates on the timeout_s parameter (default, range, effects of timeout) and references parameter (what it's used for). The description enriches understanding beyond the schema.

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 'Execute RhinoCommon C# code in a live Rhino session using Roslyn.' It uses a specific verb ('Execute') and resource ('RhinoCommon C# code'), and the scope is clearly defined as 'live Rhino session'. Among siblings, this is unique as a code execution tool, easily distinguishable from geometry creation or analysis tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly warns that the tool runs arbitrary code and is gated behind an environment variable, implying it should only be used in trusted sessions. It does not explicitly name alternatives (e.g., rhino_execute_python) but the context of arbitrary code execution versus specific tool commands provides a clear usage guideline.

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/EaseHee/rhino-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server