Skip to main content
Glama

Create C# Script

unity_create_script

Create Unity 6 C# scripts from templates, refresh AssetDatabase, and let Unity compile them. Specify path, template, class name, and overwrite as needed.

Instructions

Create a script from a Unity 6 template. Refreshes AssetDatabase so Unity compiles it.

Args: path ('Assets/Scripts/PlayerController.cs'), template monobehaviour|scriptableobject|editor|empty, class_name (default = file name; must match file name), overwrite (default false). After creating, wait for compilation (console check) before attaching.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesProject-relative script path, e.g. 'Assets/Scripts/PlayerController.cs'
templateNoUnity 6 template to generate frommonobehaviour
overwriteNoOverwrite if the file already exists (default false)
class_nameNoClass name (defaults to file name without extension; must match it)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations cover the safety profile (readOnly=false, destructive=false, idempotent=false, openWorld=false), so the bar is lower. The description adds real behavioral context beyond that: the AssetDatabase refresh side effect, the resulting Unity compilation, and the ordering constraint that you must wait for compilation before attaching. It does not, however, describe failure modes when overwrite is false and the file exists.

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?

Front-loaded with the action, then the side effect, then a compact Args block and a closing workflow note. It is efficient, though the Args enumeration partly duplicates what the schema already says.

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?

For a mutating creation tool with annotations and no output schema, the description covers the essential behavior: template-based creation, AssetDatabase refresh, and the compilation-wait step needed before attaching. Missing only edge-case handling such as existing-file behavior, which the overwrite flag partially implies.

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 100%, so the schema already documents all four parameters including the class_name/file-name constraint and enum values. The description largely restates those fields (example path, template list, defaults), so baseline 3 applies with no meaningful addition.

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 opens with a clear verb+resource: 'Create a script from a Unity 6 template.' This distinguishes it from read/update/list siblings by action. It does not explicitly name an alternative (e.g. unity_update_script), so it stops short of full sibling differentiation.

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?

There is workflow guidance ('After creating, wait for compilation (console check) before attaching'), which implies this is a prerequisite step for unity_attach_script. However, there is no explicit statement of when to use this versus unity_update_script or unity_list_scripts, so usage is only implied.

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