Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
UNITY_BRIDGE_HOSTNoBridge host (keep loopback).127.0.0.1
UNITY_BRIDGE_PORTNoPreferred port. If busy, the bridge scans upward (up to +100) and writes the actual port to %TEMP%/unity-mcp-bridge.port, which the server reads automatically. Set the env var explicitly to pin a port (required for multi-instance).auto

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
unity_pingA

Check whether the Unity Editor bridge is reachable and report Unity/editor versions.

Use when: before any other Unity tool, or when calls fail with connection errors. Don't use when: you already have a fresh successful response — skip re-pinging.

unity_get_project_infoA

Get project name, path, Unity version, active scene and play-mode state.

Use when: starting a session to orient yourself in the project. Returns: { projectName, projectPath, unityVersion, activeScene{name,path,isDirty,rootCount}, playMode }.

unity_get_scene_infoA

Get the active scene: name, path, dirty flag, root object count, build index.

Use when: you need to know which scene is open before querying hierarchy.

unity_get_hierarchyA

List root GameObjects of the active scene with components summary. Paginated.

Args:

  • root_only (bool, default true): only roots; false includes one level of children in 'children'

  • limit (1-100, default 20), offset (default 0)

  • response_format markdown|json

Use when: exploring what is in the scene. For search use unity_find_gameobjects. Returns markdown list + structured { total, count, offset, items, has_more, next_offset }.

unity_save_sceneA

Save the active scene to disk (AssetDatabase + EditorSceneManager.SaveOpenScenes).

Use when: after create/delete/transform batches so work is not lost. Idempotent: saving twice has no extra effect.

unity_find_gameobjectsA

Search GameObjects by name substring, tag, or component type. At least one filter required. Paginated.

Examples:

  • name_contains "Player" -> players, spawn points

  • tag "Enemy" -> all enemies

  • with_component "Rigidbody" -> physics objects Returns { total, count, offset, items[{name,path,active}], has_more, next_offset }.

unity_get_object_infoA

Full details of one GameObject by hierarchy path: transform, tag/layer, components list.

Use path like 'Player' or 'Level/Enemies/Orc'. For search use unity_find_gameobjects first.

unity_get_componentsA

List all components on a GameObject with enabled flags.

Use when: inspecting what behaviour/rendering an object has before modifying it.

unity_create_gameobjectA

Create an empty GameObject or a Unity primitive (cube/sphere/capsule/cylinder/plane/quad), optionally parented. Uses Undo so it can be reverted in Editor.

Args: name (required), primitive_type (default none), position/rotation/scale arrays, parent_path (optional). Returns { path, name }. Save with unity_save_scene when done.

unity_delete_gameobjectA

Delete a GameObject by path (Undo-able in Editor, but file-wise destructive once scene is saved).

Provide exact path from unity_find_gameobjects. Double-check path before calling.

unity_set_transformA

Partially update position (world), rotation euler degrees (world), scale (local). Provide only fields to change.

Example: {"path":"Player","position":[0,1,0]} moves player without touching rotation.

unity_add_componentA

Add a component by type name to a GameObject. Uses Undo.

Example: {"path":"Player","component_type":"Rigidbody"}. Check unity_get_components first to avoid duplicates.

unity_set_component_propertyA

Set one serialized property/field on a component. Value is parsed as JSON.

Examples:

  • {"path":"Player","component_type":"Rigidbody","property":"mass","value_json":"5.0"}

  • {"path":"Sun","component_type":"Light","property":"intensity","value_json":"2.5"} Fails with allowed-type hint if the property is not settable — read the error and retry.

unity_get_console_logsA

Read buffered Unity console entries, most recent first. Filter by type.

Use when: 'summarize warnings/errors', 'check console after my change', verifying a fix. For full stacks use response_format json (stackTrace included). Default types: warning+error.

unity_clear_consoleA

Clear the Unity console buffer (log cache in the bridge + Editor log view).

Use when: you want a clean baseline before reproducing an error.

unity_get_play_modeA

Report stopped|playing|paused. Use before set or before assuming edits apply (edits in play mode are discarded on stop).

unity_set_play_modeA

Enter/exit play mode: play|stop|pause|unpause. Scene edits made while playing are lost on stop — prefer stopped for structural changes.

unity_list_scriptsA

List .cs files under a project folder with sizes. Paginated.

Args: folder (default 'Assets'), filter substring (optional), limit/offset. Use when: finding where game code lives before reading or editing it.

unity_read_scriptA

Read a script with line numbers, paginated. Always read before updating.

Args: path ('Assets/Scripts/X.cs'), start_line (1-based, default 1), max_lines (default 200). Returns { path, total_lines, start_line, content } — content lines prefixed 'line: code'.

unity_create_scriptA

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.

unity_update_scriptA

Replace an exact text block in a script (like a focused diff hunk). Fails unless old_text occurs exactly expected_occurrences times.

Workflow: unity_read_script first, copy old_text verbatim (whitespace matters), then call with new_text. Returns { path, replaced, total_lines }. Unity recompiles after the change — check console for errors.

unity_attach_scriptA

Attach a MonoBehaviour class to a GameObject (Undo-able). Script must be compiled — no compile errors in console.

Args: object_path ('Player'), script_class ('PlayerController'). Fails with hint if the class is not found (typo? not compiled yet?) — read the error.

unity_list_assetsA

Browse AssetDatabase: find assets by folder, name substring and type. Paginated.

Args: folder (default 'Assets'), filter (name substring, optional), type (Prefab/Material/Texture2D/AudioClip/Scene/..., optional), limit/offset. Use when: locating prefabs, materials or textures before instantiating or assigning them.

unity_import_assetA

Force Unity to reimport an asset (picks up external file changes).

Args: path ('Assets/Textures/logo.png'). Idempotent — reimporting twice is harmless.

unity_asset_dependenciesA

List what an asset depends on (textures of a material, scripts of a prefab, ...). Recursive by default.

Args: path, recursive (default true). Use when: checking what will break if you move/delete an asset, or why a prefab pulls in half the project.

unity_folder_structureA

Map the project folder tree up to a depth (default 3). Read-only overview of how the project is organized.

Args: folder (default 'Assets'), depth 1-5 (default 3). Large folders are truncated with a note — drill into subfolders for detail.

unity_instantiate_prefabA

Instantiate a prefab from an asset path into the active scene (Undo-able). Keeps the prefab link so overrides can be applied later.

Args: prefab_path ('Assets/Prefabs/Enemy.prefab'), name override (optional), position/rotation, parent_path (optional). Find prefabs first with unity_list_assets type='Prefab'.

unity_apply_prefabA

Apply an instance's overrides back to its prefab source (Undo-able, but affects all instances once saved).

Args: object_path of the instance ('Level/Enemy_1'). Fails with hint if the object is not a prefab instance.

unity_execute_codeA

Compile and run bare C# statements inside the Unity Editor via Roslyn/AssemblyBuilder. Returns a job_id immediately — poll unity_get_code_result for completion (compile takes ~2-10s).

Code rules: bare statements only (wrapped into static Run(); UnityEngine/UnityEditor/System/LINQ usings included); 'return ;' sends JSON back. Keep snippets short and side-effect aware (runs on main thread; infinite loops hang the Editor). Sandbox blocks: filesystem (System.IO/File./Directory.), processes, network, reflection-load (Assembly.Load/Activator/DllImport), Application.Quit, while(true)/for(;;). Requires: mutations ON + 'Enable C# execution' in Window > Unity MCP (off by default).

unity_get_code_resultA

Poll a code-execution job: running | done {output, logs} | error {error, logs}.

Use when: after unity_execute_code returned a job_id. If still running, wait and poll again. Output is the JSON of your 'return' value; logs are Debug.Log lines captured during Run().

unity_set_player_inputA

Drive the player tank remotely: throttle/steer become the TankController input (physical keyboard ignored while override is on). Fire is edge-triggered — one call queues exactly one shot.

Loop: unity_get_game_state -> decide -> unity_set_player_input (repeat ~2-5x/sec) -> poll result. Call unity_clear_player_input to hand control back to the human.

unity_clear_player_inputA

Hand control back to the human: disables the remote override, zeroes throttle/steer, drops queued shots.

unity_get_game_stateA

One-call snapshot for self-play: every tank's team, hp/maxHP, alive, position [x,y,z], hull yaw, turret yaw, reload fraction (1 = ready).

Use in the drive loop before each unity_set_player_input. JSON format recommended for parsing.

unity_refresh_assetsA

Trigger Unity asset reimport + script recompilation on demand (AssetDatabase.Refresh).

Use when: files were written to the project from outside the Editor (scripts, models, textures) and Unity hasn't picked them up yet — e.g. background work while the Editor is unfocused. Idempotent.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.9/5.0

Scored across 34 tools

Disambiguation4/5

Most tools target distinct resources and actions, and the descriptions actively cross-reference each other (e.g. find_gameobjects vs get_hierarchy). Minor overlap exists in the get_project_info / get_scene_info / get_play_mode cluster, since project_info already returns scene and play-mode state, and refresh_assets vs import_asset both trigger reimports.

Naming Consistency5/5

Every tool uses the unity_ prefix with a consistent verb_noun snake_case pattern (get_, set_, create_, delete_, list_, find_, read_, update_, clear_, apply_). No camelCase mixing or inconsistent verb styles; highly predictable.

Tool Count3/5

34 tools is heavy and sits above the comfortable 3-15 range, spanning scene, GameObject, component, script, asset, console, code-execution, and a game-drive loop. Each tool is individually justified, but the surface is broad enough that discoverability and context cost suffer.

Completeness4/5

Strong lifecycle coverage: GameObject create/delete/transform, components add/set, scripts create/read/update, assets list/deps, console, play mode, and code execution. Gaps include no scene open/create/load, no component removal, no script/asset deletion, and no prefab creation, though agents can often work around these.

Maintenance

ActivityMaintained
ResponsivenessNo issues