refresh_unity
Auto-generated from the Python tool registry. Do not hand-edit outside
<!-- examples:start --><!-- examples:end -->blocks — the generator (tools/generate_docs_reference.py) will overwrite them.
Group: core · Module: services.tools.refresh_unity
Maturity: stable (support status; independent of enabled state, readiness and permissions).
Description
Refresh assets and optionally request compilation. Reports no_op when nothing was dispatched, compilation.status and last_successful_compilation separately from Editor readiness. wait_for_ready waits for native readiness, not background scan coverage or source-revision proof. Timeout retains the latest evidence and its age; it does not replay or cancel native work.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
mode | Literal['if_dirty', 'force'] | — | Refresh mode |
scope | Literal['assets', 'scripts', 'all'] | — | Refresh scope |
compile | Literal['none', 'request'] | — | Whether to request compilation |
force_recompile | bool | — | Request a clean compilation; requires scope=scripts and compile=request |
wait_for_ready | bool | — | If true, wait until mcpforunity://editor/state reports data.advice.ready_for_tools true |
timeout_seconds | float | — | Total refresh/readiness observation budget in seconds; expiry does not undo native work |
unity_instance | str | int | None | — | Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance. |
Returns
A dict containing the Unity response. The exact shape depends on the action.
Examples
After saving C# files, ask the selected Editor for a scripts refresh and compile if dirty. A readiness timeout bounds the wait. Use the returned compile job ID to observe compilation separately.
{
"mode": "if_dirty",
"scope": "scripts",
"compile": "request",
"wait_for_ready": true,
"timeout_seconds": 30
}