# Unity-MCP Tools Reference Every built-in MCP tool, with its main actions, parameters, and usage examples. For a tool's full parameter table, open its generated page: `https://coplaydev.github.io/unity-mcp/reference/tools//` (tools with no group, such as `manage_tools`, are under `core`). Each section names the tool's group when it is not `core`. A tool outside `core` can be hidden (over HTTP, only `core` starts enabled); enable its group with `manage_tools(action="activate", group="")`. > **Template warning:** Examples in this file are skill templates and may be inaccurate for some Unity versions, packages, or project setups. Validate parameters and payload shapes against your active tool schema and runtime behavior. ## Table of Contents - [Infrastructure Tools](#infrastructure-tools) - [Scene Tools](#scene-tools) - [GameObject Tools](#gameobject-tools) - [Script Tools](#script-tools) - [Asset Tools](#asset-tools) - [Material & Shader Tools](#material--shader-tools) - [UI Tools](#ui-tools) - [Editor Control Tools](#editor-control-tools) - [Build Tools](#build-tools) - [Testing Tools](#testing-tools) - [Search Tools](#search-tools) - [Custom Tools](#custom-tools) - [Camera Tools](#camera-tools) - [Graphics Tools](#graphics-tools) - [Package Tools](#package-tools) - [Physics Tools](#physics-tools) - [ProBuilder Tools](#probuilder-tools) - [Profiler Tools](#profiler-tools) - [Docs Tools](#docs-tools) - [Animation Tools](#animation-tools) - [VFX Tools](#vfx-tools) - [Scripting Extension Tools](#scripting-extension-tools) - [Asset Generation Tools](#asset-generation-tools) --- ## Project Info Resource Read `mcpforunity://project/info` to detect project capabilities before making assumptions about UI, input, or rendering setup. **Returned fields:** | Field | Type | Description | |-------|------|-------------| | `projectRoot` | string | Absolute path to project root | | `projectName` | string | Project folder name | | `unityVersion` | string | e.g. `"2022.3.20f1"` | | `platform` | string | Active build target e.g. `"StandaloneWindows64"` | | `assetsPath` | string | Absolute path to Assets folder | | `renderPipeline` | string | `"BuiltIn"`, `"Universal"`, `"HighDefinition"`, or `"Custom"` | | `activeInputHandler` | string | `"Old"`, `"New"`, or `"Both"` | | `packages.ugui` | bool | `com.unity.ugui` installed (Canvas, Image, Button, etc.) | | `packages.textmeshpro` | bool | `com.unity.textmeshpro` installed (TMP_Text, TMP_InputField) | | `packages.inputsystem` | bool | `com.unity.inputsystem` installed (InputAction, PlayerInput) | | `packages.uiToolkit` | bool | Always `true` for Unity 2021.3+ (UIDocument, VisualElement, UXML/USS) | | `packages.screenCapture` | bool | `com.unity.modules.screencapture` enabled (ScreenCapture API for screenshots) | **Key decision points:** - **UI system**: If `packages.uiToolkit` is true (always for Unity 2021+), use `manage_ui` for UI Toolkit workflows (UXML/USS). If `packages.ugui` is true, use Canvas + uGUI components via `batch_execute`. UI Toolkit is preferred for new UI — it uses a frontend-like workflow (UXML for structure, USS for styling). - **Text**: If `packages.textmeshpro` is true, use `TextMeshProUGUI` instead of legacy `Text`. - **Input**: Use `activeInputHandler` to decide EventSystem module — `StandaloneInputModule` (Old) vs `InputSystemUIInputModule` (New). See [workflows.md — Input System](workflows.md#input-system-old-vs-new). - **Shaders**: Use `renderPipeline` to pick correct shader names — `Standard` (BuiltIn) vs `Universal Render Pipeline/Lit` (URP) vs `HDRP/Lit` (HDRP). --- ## Infrastructure Tools ### batch_execute Execute multiple MCP commands in a single batch (10-100x faster). ```python batch_execute( commands=[ # list[dict], required, max 25 {"tool": "tool_name", "params": {...}}, ... ], parallel=False, # bool, optional - advisory only (Unity may still run sequentially) fail_fast=False, # bool, optional - stop on first failure max_parallelism=None # int, optional - max parallel workers ) ``` `batch_execute` is not transactional: earlier commands are not rolled back if a later command fails. ### set_active_instance Route commands to a specific Unity instance (multi-instance workflows). ```python set_active_instance( instance="ProjectName@abc123" # str, required - Name@hash or hash prefix ) ``` ### refresh_unity Refresh asset database and trigger script compilation. ```python refresh_unity( mode="if_dirty", # "if_dirty" | "force" scope="all", # "assets" | "scripts" | "all" compile="none", # "none" | "request" wait_for_ready=True # bool - wait until editor ready ) ``` ### manage_tools Show, enable, or hide tool groups for the current session. Always visible (no group). ```python manage_tools(action="list_groups") # every group, whether it is on, and its tools manage_tools(action="activate", group="animation") # "deactivate" hides a group again manage_tools(action="sync") # re-read the tool toggles in the Unity editor manage_tools(action="reset") # back to the defaults ``` Groups: `core`, `animation`, `asset_gen`, `docs`, `probuilder`, `profiling`, `scripting_ext`, `testing`, `ui`, `vfx`. The `mcpforunity://tool-groups` resource lists the same catalog read-only. [Full parameters](https://coplaydev.github.io/unity-mcp/reference/tools/core/manage_tools) ### debug_request_context Diagnostics: returns the request's `client_id`, `session_id` and meta, the session's active Unity instance, and the server version. No parameters; always visible (no group). ```python debug_request_context() ``` [Full parameters](https://coplaydev.github.io/unity-mcp/reference/tools/core/debug_request_context) --- ## Scene Tools ### manage_scene Scene CRUD operations, hierarchy queries, multi-scene editing, validation, and scene view control. Screenshots are `manage_camera` actions (see [Camera Tools](#camera-tools)); build-settings scenes are `manage_build(action="scenes")`. ```python # Get hierarchy (paginated) manage_scene( action="get_hierarchy", page_size=50, # int, default 50, max 500 cursor=0, # int, pagination cursor parent=None, # str|int, optional - filter by parent include_transform=False # bool - include local transforms ) # Frame scene view on target manage_scene( action="scene_view_frame", scene_view_target="Player" # str|int - GO name, path, or instance ID to frame ) # Other actions manage_scene(action="get_active") # Current scene info manage_scene(action="get_build_settings") # Build settings manage_scene(action="create", name="NewScene", path="Assets/Scenes/") manage_scene(action="load", path="Assets/Scenes/Main.unity") manage_scene(action="save") # Scene templates: "empty" (no objects), "default", "3d_basic", "2d_basic" manage_scene(action="create", name="Level1", path="Assets/Scenes/", template="3d_basic") # Multi-scene editing manage_scene(action="load", path="Assets/Scenes/Level2.unity", additive=True) # keep current scene manage_scene(action="get_loaded_scenes") manage_scene(action="set_active_scene", scene_name="Level2") manage_scene(action="move_to_scene", target="Player", scene_name="Level2") # moves a root GameObject manage_scene(action="close_scene", scene_name="Level2", remove_scene=True) # remove_scene=False only unloads # Validation: missing scripts, broken prefabs manage_scene(action="validate") manage_scene(action="validate", auto_repair=True) # also removes missing scripts (undoable) ``` ### find_gameobjects Search for GameObjects (returns instance IDs only). ```python find_gameobjects( search_term="Player", # str, required search_method="by_name", # "by_name"|"by_tag"|"by_layer"|"by_component"|"by_path"|"by_id" include_inactive=False, # bool|str page_size=50, # int, default 50, max 500 cursor=0 # int, pagination cursor ) # Returns: {"ids": [12345, 67890], "next_cursor": 50, ...} ``` --- ## GameObject Tools ### manage_gameobject Create, modify, delete, duplicate GameObjects. ```python # Create manage_gameobject( action="create", name="MyCube", # str, required primitive_type="Cube", # "Cube"|"Sphere"|"Capsule"|"Cylinder"|"Plane"|"Quad" position=[0, 1, 0], # list[float] or JSON string "[0,1,0]" rotation=[0, 45, 0], # euler angles scale=[1, 1, 1], components_to_add=["Rigidbody", "BoxCollider"], save_as_prefab=False, prefab_path="Assets/Prefabs/MyCube.prefab" ) # Prefab instantiation — place a prefab instance in the scene manage_gameobject( action="create", name="Enemy_1", prefab_path="Assets/Prefabs/Enemy.prefab", position=[5, 0, 3], parent="Enemies" # optional parent GameObject ) # Smart lookup — just the prefab name works too: manage_gameobject(action="create", name="Enemy_2", prefab_path="Enemy", position=[10, 0, 3]) # Modify manage_gameobject( action="modify", target="Player", # name, path, or instance ID search_method="by_name", # how to find target position=[10, 0, 0], rotation=[0, 90, 0], scale=[2, 2, 2], set_active=True, layer="Player", components_to_add=["AudioSource"], components_to_remove=["OldComponent"], component_properties={ # nested dict for property setting "Rigidbody": { "mass": 10.0, "useGravity": True } } ) # Delete manage_gameobject(action="delete", target="OldObject") # Duplicate manage_gameobject( action="duplicate", target="Player", new_name="Player2", offset=[5, 0, 0] # position offset from original ) # Move relative manage_gameobject( action="move_relative", target="Player", reference_object="Enemy", # optional reference direction="left", # "left"|"right"|"up"|"down"|"forward"|"back" distance=5.0, world_space=True ) # Look at target (rotates GO to face a point or another GO) manage_gameobject( action="look_at", target="MainCamera", # the GO to rotate look_at_target="Player", # str (GO name/path) or list[float] world position look_at_up=[0, 1, 0] # optional up vector, default [0,1,0] ) ``` ### manage_components Add, remove, or set properties on components. ```python # Add component manage_components( action="add", target=12345, # instance ID (preferred) or name component_type="Rigidbody", search_method="by_id" ) # Remove component manage_components( action="remove", target="Player", component_type="OldScript" ) # Set single property manage_components( action="set_property", target=12345, component_type="Rigidbody", property="mass", value=5.0 ) # Set multiple properties manage_components( action="set_property", target=12345, component_type="Transform", properties={ "position": [1, 2, 3], "localScale": [2, 2, 2] } ) # Set object reference property (reference another GameObject by name) manage_components( action="set_property", target="GameManager", component_type="GameManagerScript", property="targetObjects", value=[{"name": "Flower_1"}, {"name": "Flower_2"}, {"name": "Bee_1"}] ) # Object reference formats supported: # - {"name": "ObjectName"} → Find GameObject in scene by name # - {"instanceID": 12345} → Direct instance ID reference # - {"guid": "abc123..."} → Asset GUID reference # - {"path": "Assets/..."} → Asset path reference # - "Assets/Prefabs/My.prefab" → String shorthand for asset paths # - "ObjectName" → String shorthand for scene name lookup # - 12345 → Integer shorthand for instanceID # - {"guid": "...", "spriteName": "Hero_0"} or {"guid": "...", "fileID": 12345} # → Sprite sub-asset of a sliced sheet (single-sprite textures resolve from guid/path alone) ``` --- ## Script Tools ### create_script Create a new C# script. ```python create_script( path="Assets/Scripts/MyScript.cs", # str, required contents='''using UnityEngine; public class MyScript : MonoBehaviour { void Start() { } void Update() { } }''', script_type="MonoBehaviour", # optional hint namespace="MyGame" # optional namespace ) ``` ### script_apply_edits Apply structured edits to C# scripts (safer than raw text edits). ```python script_apply_edits( name="MyScript", # script name (no .cs) path="Assets/Scripts", # folder path edits=[ # Replace entire method { "op": "replace_method", "methodName": "Update", "replacement": "void Update() { transform.Rotate(Vector3.up); }" }, # Insert new method { "op": "insert_method", "afterMethod": "Start", "code": "void OnEnable() { Debug.Log(\"Enabled\"); }" }, # Delete method { "op": "delete_method", "methodName": "OldMethod" }, # Anchor-based insert { "op": "anchor_insert", "anchor": "void Start()", "position": "before", # "before" | "after" "text": "// Called before Start\n" }, # Regex replace { "op": "regex_replace", "pattern": "Debug\\.Log\\(", "text": "Debug.LogWarning(" }, # Prepend/append to file {"op": "prepend", "text": "// File header\n"}, {"op": "append", "text": "\n// File footer"} ] ) ``` ### apply_text_edits Apply precise character-position edits (1-indexed lines/columns). ```python apply_text_edits( uri="mcpforunity://path/Assets/Scripts/MyScript.cs", edits=[ { "startLine": 10, "startCol": 5, "endLine": 10, "endCol": 20, "newText": "replacement text" } ], precondition_sha256="abc123...", # optional, prevents stale edits strict=True # optional, stricter validation ) ``` ### validate_script Check script for syntax/semantic errors. ```python validate_script( uri="mcpforunity://path/Assets/Scripts/MyScript.cs", level="standard", # "basic" | "standard" include_diagnostics=True # include full error details ) ``` ### get_sha Get file hash without content (for preconditions). ```python get_sha(uri="mcpforunity://path/Assets/Scripts/MyScript.cs") # Returns: {"sha256": "...", "lengthBytes": 1234} ``` ### delete_script Delete a script file. ```python delete_script(uri="mcpforunity://path/Assets/Scripts/OldScript.cs") ``` ### manage_script Legacy whole-file router with three actions: `create`, `read`, `delete`. `name` is the class name without `.cs`; `path` is its folder under `Assets/`. There is no update action: edit with `script_apply_edits` or `apply_text_edits`. ```python manage_script(action="read", name="PlayerController", path="Assets/Scripts") # returns the file contents ``` [Full parameters](https://coplaydev.github.io/unity-mcp/reference/tools/core/manage_script) ### manage_script_capabilities Lists the edit ops `script_apply_edits` supports (structured and text), the max edit payload size, and the active guards. No parameters; always visible (no group). ```python manage_script_capabilities() ``` [Full parameters](https://coplaydev.github.io/unity-mcp/reference/tools/core/manage_script_capabilities) --- ## Asset Tools ### manage_asset Asset operations: search, import, create, modify, delete. ```python # Search assets (paginated) manage_asset( action="search", path="Assets", # search scope search_pattern="*.prefab", # glob or "t:MonoScript" filter filter_type="Prefab", # optional type filter page_size=25, # keep small to avoid large payloads page_number=1, # 1-based generate_preview=False # avoid base64 bloat ) # Get asset info manage_asset(action="get_info", path="Assets/Prefabs/Player.prefab") # Create asset manage_asset( action="create", path="Assets/Materials/NewMaterial.mat", asset_type="Material", properties={"color": [1, 0, 0, 1]} ) # Duplicate/move/rename manage_asset(action="duplicate", path="Assets/A.prefab", destination="Assets/B.prefab") manage_asset(action="move", path="Assets/A.prefab", destination="Assets/Prefabs/A.prefab") manage_asset(action="rename", path="Assets/A.prefab", destination="Assets/B.prefab") # Create folder manage_asset(action="create_folder", path="Assets/NewFolder") # Delete manage_asset(action="delete", path="Assets/OldAsset.asset") ``` ### manage_prefabs Prefab assets: headless edits with `modify_contents`, or interactive editing in a prefab stage. ```python # Get prefab info manage_prefabs(action="get_info", prefab_path="Assets/Prefabs/Player.prefab") # Get prefab hierarchy manage_prefabs(action="get_hierarchy", prefab_path="Assets/Prefabs/Player.prefab") # Create prefab from scene GameObject manage_prefabs( action="create_from_gameobject", target="Player", # GameObject in scene prefab_path="Assets/Prefabs/Player.prefab", allow_overwrite=False ) # Modify prefab contents (headless) manage_prefabs( action="modify_contents", prefab_path="Assets/Prefabs/Player.prefab", target="ChildObject", # object within prefab position=[0, 1, 0], components_to_add=["AudioSource"] ) # Delete child GameObjects from prefab manage_prefabs( action="modify_contents", prefab_path="Assets/Prefabs/Player.prefab", delete_child=["OldChild", "Turret/Barrel"] # single string or list ) # Create child GameObject in prefab manage_prefabs( action="modify_contents", prefab_path="Assets/Prefabs/Player.prefab", create_child={"name": "SpawnPoint", "primitive_type": "Sphere", "position": [0, 2, 0]} ) # A list creates several children in one save; "source_prefab_path" instead of # "primitive_type" nests a prefab instance: {"name": "Gun", "source_prefab_path": "Assets/Prefabs/Gun.prefab"} # Set component properties on prefab contents manage_prefabs( action="modify_contents", prefab_path="Assets/Prefabs/Player.prefab", target="ChildObject", component_properties={"Rigidbody": {"mass": 5.0}, "MyScript": {"health": 100}} ) # Interactive: open a prefab stage, edit with manage_gameobject/manage_components, save, close manage_prefabs(action="open_prefab_stage", prefab_path="Assets/Prefabs/Enemy.prefab") manage_prefabs(action="save_prefab_stage") manage_prefabs(action="close_prefab_stage") # back to the main scene ``` --- ## Material & Shader Tools ### manage_material Create and modify materials. ```python # Create material manage_material( action="create", material_path="Assets/Materials/Red.mat", shader="Standard", properties={"_Color": [1, 0, 0, 1]} ) # Get material info manage_material(action="get_material_info", material_path="Assets/Materials/Red.mat") # Set shader property manage_material( action="set_material_shader_property", material_path="Assets/Materials/Red.mat", property="_Metallic", value=0.8 ) # Set color manage_material( action="set_material_color", material_path="Assets/Materials/Red.mat", property="_BaseColor", color=[0, 1, 0, 1] # RGBA ) # Assign to renderer manage_material( action="assign_material_to_renderer", target="MyCube", material_path="Assets/Materials/Red.mat", slot=0 # material slot index ) # Set renderer color directly manage_material( action="set_renderer_color", target="MyCube", color=[1, 0, 0, 1], mode="create_unique" # Creates a unique .mat asset per object (persistent) # Other modes: "property_block" (default, not persistent), # "shared" (mutates shared material — avoid for primitives), # "instance" (runtime only, not persistent) ) ``` ### manage_texture Create procedural textures. Group: `vfx`. ```python manage_texture( action="create", path="Assets/Textures/Checker.png", width=64, height=64, fill_color=[255, 255, 255, 255] # or [1.0, 1.0, 1.0, 1.0] ) # Apply pattern manage_texture( action="apply_pattern", path="Assets/Textures/Checker.png", pattern="checkerboard", # "checkerboard"|"stripes"|"dots"|"grid"|"brick" palette=[[0,0,0,255], [255,255,255,255]], pattern_size=8 ) # Apply gradient manage_texture( action="apply_gradient", path="Assets/Textures/Gradient.png", gradient_type="linear", # "linear"|"radial" gradient_angle=45, palette=[[255,0,0,255], [0,0,255,255]] ) ``` ### manage_shader Create, read, update, or delete `.shader` files. Group: `vfx`. `name` is the file name without `.shader`; `path` is its folder under `Assets/`. To use the shader, pass the name declared in its `Shader "..."` line to `manage_material`. ```python manage_shader(action="create", name="UnlitTint", path="Assets/Shaders", contents='Shader "Custom/UnlitTint" { ... }') ``` [Full parameters](https://coplaydev.github.io/unity-mcp/reference/tools/vfx/manage_shader) --- ## UI Tools ### manage_ui Manage Unity UI Toolkit elements: UXML documents, USS stylesheets, UIDocument components, and visual tree inspection. Group: `ui`. ```python # Create a UXML file manage_ui( action="create", path="Assets/UI/MainMenu.uxml", contents='' ) # Create a USS stylesheet manage_ui( action="create", path="Assets/UI/Styles.uss", contents=".title { font-size: 32px; color: white; }" ) # Read a UXML/USS file manage_ui( action="read", path="Assets/UI/MainMenu.uxml" ) # Returns: {"success": true, "data": {"contents": "...", "path": "..."}} # Update an existing file manage_ui( action="update", path="Assets/UI/Styles.uss", contents=".title { font-size: 48px; color: yellow; -unity-font-style: bold; }" ) # Attach UIDocument to a GameObject manage_ui( action="attach_ui_document", target="UICanvas", # GameObject name or path source_asset="Assets/UI/MainMenu.uxml", panel_settings="Assets/UI/Panel.asset", # optional, auto-creates if omitted sort_order=0 # optional, default 0 ) # Create PanelSettings asset manage_ui( action="create_panel_settings", path="Assets/UI/Panel.asset", scale_mode="ScaleWithScreenSize", # optional: "ConstantPixelSize"|"ConstantPhysicalSize"|"ScaleWithScreenSize" reference_resolution={"width": 1920, "height": 1080} # optional, for ScaleWithScreenSize ) # Inspect the visual tree of a UIDocument manage_ui( action="get_visual_tree", target="UICanvas", # GameObject with UIDocument max_depth=10 # optional, default 10 ) # Returns: hierarchy of VisualElements with type, name, classes, styles, text, children ``` **UI Toolkit workflow:** 1. Create UXML (structure, like HTML) and USS (styling, like CSS) files 2. Create a PanelSettings asset (or let `attach_ui_document` auto-create one) 3. Create an empty GameObject and attach UIDocument with the UXML source 4. Use `get_visual_tree` to inspect the result **Important:** Always use `` (with the `ui:` namespace prefix) in UXML files, not bare `