Skip to main content
Glama

Execute Code

execute_code
Destructive

Run C# code in the Unity Editor directly. Supports code execution, history, replay, and safety checks to prevent harmful operations.

Instructions

Execute arbitrary C# code inside the Unity Editor. The code runs as a method body with access to UnityEngine and UnityEditor namespaces. Use 'return' to send data back. Compiled in-memory — no script files created. Actions: execute (run code), get_history (list past executions), replay (re-run a history entry), clear_history. NOTE: safety_checks blocks known dangerous patterns but is not a full sandbox. Compiler options: 'auto' (Roslyn if available, else CodeDom), 'roslyn' (C# 12+, requires Microsoft.CodeAnalysis), 'codedom' (C# 6 only).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo
indexNo
limitNoNumber of history entries to return (for 'get_history' action, 1-50). Default: 10.
actionYesAction to perform.
compilerNoCompiler backend for 'execute' action. 'auto' uses Roslyn if Microsoft.CodeAnalysis is installed, else falls back to CodeDom. 'roslyn' forces Roslyn (C# 12+). 'codedom' forces legacy CSharpCodeProvider (C# 6). Default: auto.auto
safety_checksNoEnable basic blocked-pattern checks (File.Delete, Process.Start, infinite loops, etc). Not a full sandbox — advanced bypass is possible. Default: true.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

The description adds behavioral context beyond the destructiveHint annotation: code runs as a method body, no script files created, safety_checks is not a full sandbox. This helps the agent understand execution constraints and risks.

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 concise and well-structured: main purpose first, then actions list, then safety note, then compiler options. Every sentence adds value with no redundancy.

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 tool's complexity (6 parameters, multiple actions, compiler choices) and the presence of an output schema, the description covers all key aspects: purpose, actions, compiler options, and safety. Minor gaps in parameter details (code format) are acceptable given the output schema.

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 67% (code and index lack descriptions). The description adds clarity for compiler (roslyn/codedom) and safety_checks, but does not explain the 'code' parameter beyond 'arbitrary C# code' or the 'index' parameter for replay. The description partially compensates for schema gaps.

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 executes arbitrary C# code inside the Unity Editor, specifying namespaces, return usage, and in-memory compilation. It distinguishes from sibling tools like execute_menu_item by focusing on arbitrary code execution.

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 lists four actions (execute, get_history, replay, clear_history) and implicitly guides when to use the tool (for running code). However, it does not explicitly state when not to use it or compare to alternatives like execute_menu_item.

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/Ryan6-VRC/vrc-mcp-proxy'

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