Skip to main content
Glama

unity_create_script

Writes a C# script file into the Unity project, optionally generating a MonoBehaviour template and refreshing the asset database to compile it.

Instructions

Write a .cs file into the project (MonoBehaviour by default), optionally compiling it right away. (Unity editor offline right now: schemas are cached; calls will fail until it reconnects)

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "unity_create_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyNoclass body when generating a template
codeNofull file content; omit to generate a template
pathYesAssets/Scripts/Spinner.cs
compileNorefresh the asset database now, default false
baseTypeNodefault MonoBehaviour
classNameNo
namespaceNo
overwriteNodefault true

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden. It usefully discloses the operational state (editor offline, cached schemas, calls will fail until reconnect), which is real behavioral context an agent needs, but it omits the destructive risk of overwrite-by-default and says nothing about what happens on a path collision or a compile failure.

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 purpose is front-loaded in a single efficient sentence, and the parenthetical status note is kept short and clearly secondary. Nothing is redundant, though the parenthetical could be separated more cleanly from capability description.

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 an 8-parameter write tool with no annotations and no output schema, the definition covers the core action, the template default, and the connectivity caveat. It still leaves notable gaps around overwrite consequences and failure behavior, which matter for a file-writing tool.

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 coverage is 75%, so the schema already documents most parameters including path, code, body, compile, and overwrite. The description reinforces the template-vs-full-code distinction and the compile-on-write option, but adds no syntax, format, or constraint detail beyond what the schema states.

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 gives a specific verb plus resource: write a .cs file into the Unity project, with the default MonoBehaviour template behavior noted. It is clear what the tool produces, but it does not distinguish itself from plausible siblings such as unity_run_csharp or unity_create, leaving the agent to infer the boundary.

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?

There is no when-to-use or when-not-to-use guidance, and no mention of alternatives for adjacent tasks like executing C# or creating non-script assets. The only guidance-adjacent content is the default type and the optional compile step, which are parameter facts rather than routing advice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.