Skip to content

Commit d91d0f1

Browse files
committed
docs: update documentation for unity_reflect and unity_docs tools
- manifest.json: add both tools in alphabetical order - README.md: add to Available Tools, update Recent Updates - README-zh.md: mirror changes in Chinese - SKILL.md: add Docs group to tool categories with trust hierarchy - tools-reference.md: full reference for both tools with examples - workflows.md: add 5 API verification workflow patterns
1 parent 9db9068 commit d91d0f1

9 files changed

Lines changed: 344 additions & 4 deletions

File tree

.claude/skills/unity-mcp-skill/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ uri="file:///full/path/to/file.cs"
190190
| **Packages** | `manage_packages` | Install, remove, search, and manage Unity packages and scoped registries. Query actions: list installed, search registry, get info, ping, poll status. Mutating actions: add/remove packages, embed for editing, add/remove scoped registries, force resolve. Validates identifiers, warns on git URLs, checks dependents before removal (`force=true` to override). See [tools-reference.md](references/tools-reference.md#package-tools). |
191191
| **ProBuilder** | `manage_probuilder` | 3D modeling, mesh editing, complex geometry. **When `com.unity.probuilder` is installed, prefer ProBuilder shapes over primitive GameObjects** for editable geometry, multi-material faces, or complex shapes. Supports 12 shape types, face/edge/vertex editing, smoothing, and per-face materials. See [ProBuilder Guide](references/probuilder-guide.md). |
192192
| **UI** | `manage_ui`, `batch_execute` with `manage_gameobject` + `manage_components` | **UI Toolkit**: Use `manage_ui` to create UXML/USS files, attach UIDocument, inspect visual trees. **uGUI (Canvas)**: Use `batch_execute` for Canvas, Panel, Button, Text, Slider, Toggle, Input Field. **Read `mcpforunity://project/info` first** to detect uGUI/TMP/Input System/UI Toolkit availability. (see [UI workflows](references/workflows.md#ui-creation-workflows)) |
193+
| **Docs** | `unity_reflect`, `unity_docs` | API verification and documentation lookup. **`unity_reflect`** inspects live C# APIs via reflection (requires Unity connection): `search` types across assemblies, `get_type` for member summary, `get_member` for full signatures. **`unity_docs`** fetches official docs from docs.unity3d.com (no Unity connection needed): `get_doc` (ScriptReference), `get_manual` (Manual pages), `get_package_doc` (package docs), `lookup` (parallel search all sources + project assets). **Trust hierarchy: reflection > project assets > docs.** Workflow: `unity_reflect` search -> get_type -> get_member -> `unity_docs` lookup. See [tools-reference.md](references/tools-reference.md#docs-tools). |
193194

194195
## Common Workflows
195196

.claude/skills/unity-mcp-skill/references/tools-reference.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Complete reference for all MCP tools. Each tool includes parameters, types, and
1919
- [Graphics Tools](#graphics-tools)
2020
- [Package Tools](#package-tools)
2121
- [ProBuilder Tools](#probuilder-tools)
22+
- [Docs Tools](#docs-tools)
2223

2324
---
2425

@@ -1279,3 +1280,93 @@ manage_probuilder(action="validate_mesh", target="MyCube")
12791280
```
12801281

12811282
See also: [ProBuilder Workflow Guide](probuilder-guide.md) for detailed patterns and complex object examples.
1283+
1284+
---
1285+
1286+
## Docs Tools
1287+
1288+
Tools for verifying Unity C# APIs and fetching official documentation. Group: `docs`.
1289+
1290+
### `unity_reflect`
1291+
1292+
Inspect Unity's live C# API via reflection. **Always use this before writing C# code that references Unity APIs** — LLM training data frequently contains incorrect, outdated, or hallucinated APIs.
1293+
1294+
Requires Unity connection.
1295+
1296+
| Parameter | Type | Required | Description |
1297+
|-----------|------|----------|-------------|
1298+
| `action` | string | Yes | `search`, `get_type`, or `get_member` |
1299+
| `class_name` | string | For get_type, get_member | Fully qualified or simple C# class name |
1300+
| `member_name` | string | For get_member | Method, property, or field name to inspect |
1301+
| `query` | string | For search | Search query for type name search |
1302+
| `scope` | string | No | Assembly scope for search: `unity`, `packages`, `project`, `all` (default: `unity`) |
1303+
1304+
**Actions:**
1305+
1306+
- **`search`**: Search for types by name across loaded assemblies. Returns matching type names.
1307+
- **`get_type`**: Get a member summary (names only) for a class. Returns list of methods, properties, fields.
1308+
- **`get_member`**: Get full signature detail for one member. Returns parameter types, return type, overloads.
1309+
1310+
```python
1311+
# Search for types matching a name
1312+
unity_reflect(action="search", query="NavMesh")
1313+
unity_reflect(action="search", query="Camera", scope="all")
1314+
1315+
# Get all members of a type
1316+
unity_reflect(action="get_type", class_name="UnityEngine.AI.NavMeshAgent")
1317+
1318+
# Get detailed signature for a specific member
1319+
unity_reflect(action="get_member", class_name="Physics", member_name="Raycast")
1320+
unity_reflect(action="get_member", class_name="NavMeshAgent", member_name="SetDestination")
1321+
```
1322+
1323+
### `unity_docs`
1324+
1325+
Fetch official Unity documentation from docs.unity3d.com. Returns descriptions, parameter details, code examples, and caveats. Use after `unity_reflect` confirms a type exists.
1326+
1327+
No Unity connection needed for doc fetching. The `lookup` action with asset-related queries will also search project assets (requires Unity connection).
1328+
1329+
| Parameter | Type | Required | Description |
1330+
|-----------|------|----------|-------------|
1331+
| `action` | string | Yes | `get_doc`, `get_manual`, `get_package_doc`, or `lookup` |
1332+
| `class_name` | string | For get_doc | Unity class name (e.g., `Physics`, `Transform`) |
1333+
| `member_name` | string | No | Method or property name for get_doc |
1334+
| `version` | string | No | Unity version (e.g., `6000.0.38f1`). Auto-extracts major.minor. |
1335+
| `slug` | string | For get_manual | Manual page slug (e.g., `execution-order`) |
1336+
| `package` | string | For get_package_doc, optional for lookup | Package name (e.g., `com.unity.render-pipelines.universal`) |
1337+
| `page` | string | For get_package_doc | Package doc page (e.g., `index`, `2d-index`) |
1338+
| `pkg_version` | string | For get_package_doc, optional for lookup | Package version major.minor (e.g., `17.0`) |
1339+
| `query` | string | For lookup (single) | Single search query |
1340+
| `queries` | string | For lookup (batch) | Comma-separated queries (e.g., `Physics.Raycast,NavMeshAgent,Light2D`) |
1341+
1342+
**Actions:**
1343+
1344+
- **`get_doc`**: Fetch ScriptReference docs for a class or member. Parses HTML to extract description, signatures, parameters, return type, and code examples.
1345+
- **`get_manual`**: Fetch a Unity Manual page by slug. Returns title, sections, and code examples.
1346+
- **`get_package_doc`**: Fetch package documentation. Requires package name, page slug, and package version.
1347+
- **`lookup`**: Search all doc sources in parallel (ScriptReference + Manual + package docs). Supports batch queries. For asset-related queries (shader, material, texture, etc.), also searches project assets via `manage_asset`.
1348+
1349+
```python
1350+
# Fetch ScriptReference for a class
1351+
unity_docs(action="get_doc", class_name="Physics")
1352+
unity_docs(action="get_doc", class_name="Physics", member_name="Raycast")
1353+
unity_docs(action="get_doc", class_name="Transform", version="6000.0.38f1")
1354+
1355+
# Fetch a Manual page
1356+
unity_docs(action="get_manual", slug="execution-order")
1357+
unity_docs(action="get_manual", slug="urp/urp-introduction")
1358+
1359+
# Fetch package documentation
1360+
unity_docs(action="get_package_doc", package="com.unity.render-pipelines.universal",
1361+
page="2d-index", pkg_version="17.0")
1362+
1363+
# Parallel lookup across all sources (single query)
1364+
unity_docs(action="lookup", query="Physics.Raycast")
1365+
1366+
# Batch lookup (multiple queries in one call)
1367+
unity_docs(action="lookup", queries="Physics.Raycast,NavMeshAgent,Light2D")
1368+
1369+
# Lookup with package docs included
1370+
unity_docs(action="lookup", query="VolumeProfile",
1371+
package="com.unity.render-pipelines.universal", pkg_version="17.0")
1372+
```

.claude/skills/unity-mcp-skill/references/workflows.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Common workflows and patterns for effective Unity-MCP usage.
1616
- [Graphics & Rendering Workflows](#graphics--rendering-workflows)
1717
- [Package Management Workflows](#package-management-workflows)
1818
- [Package Deployment Workflows](#package-deployment-workflows)
19+
- [API Verification Workflows](#api-verification-workflows)
1920
- [Batch Operations](#batch-operations)
2021

2122
---
@@ -1902,6 +1903,79 @@ refresh_unity(mode="force", compile="request", wait_for_ready=True)
19021903

19031904
---
19041905

1906+
## API Verification Workflows
1907+
1908+
### Full API Verification Before Writing Code
1909+
1910+
Use `unity_reflect` and `unity_docs` to verify Unity APIs before writing C# code. This prevents hallucinated or outdated API references.
1911+
1912+
**Trust hierarchy:** reflection (live runtime) > project assets > official docs.
1913+
1914+
```python
1915+
# Step 1: Search for the type you need
1916+
unity_reflect(action="search", query="NavMesh")
1917+
# → Returns matching types: NavMeshAgent, NavMeshPath, NavMeshHit, etc.
1918+
1919+
# Step 2: Get member summary for the type
1920+
unity_reflect(action="get_type", class_name="UnityEngine.AI.NavMeshAgent")
1921+
# → Returns all methods, properties, fields (names only)
1922+
1923+
# Step 3: Get full signature for specific members you plan to use
1924+
unity_reflect(action="get_member", class_name="NavMeshAgent", member_name="SetDestination")
1925+
# → Returns parameter types, return type, all overloads
1926+
1927+
# Step 4: Get official docs for usage patterns and examples
1928+
unity_docs(action="get_doc", class_name="NavMeshAgent", member_name="SetDestination")
1929+
# → Returns description, signatures, parameters, code examples
1930+
```
1931+
1932+
### Batch API Lookup
1933+
1934+
Use `unity_docs` `lookup` action to search multiple APIs in a single call:
1935+
1936+
```python
1937+
# Search ScriptReference + Manual + package docs in parallel
1938+
unity_docs(action="lookup", queries="Physics.Raycast,NavMeshAgent,Light2D")
1939+
1940+
# Include package docs in the search
1941+
unity_docs(action="lookup", query="VolumeProfile",
1942+
package="com.unity.render-pipelines.universal", pkg_version="17.0")
1943+
```
1944+
1945+
### Finding Shaders and Materials in Project
1946+
1947+
The `lookup` action automatically searches project assets for asset-related queries:
1948+
1949+
```python
1950+
# This searches both docs AND project assets for shader-related content
1951+
unity_docs(action="lookup", query="Lit shader")
1952+
# → Returns doc hits + matching project assets (shaders, materials, etc.)
1953+
```
1954+
1955+
### Manual and Package Documentation
1956+
1957+
```python
1958+
# Fetch Unity Manual pages (execution order, scripting concepts, etc.)
1959+
unity_docs(action="get_manual", slug="execution-order")
1960+
1961+
# Fetch package-specific documentation
1962+
unity_docs(action="get_package_doc",
1963+
package="com.unity.render-pipelines.universal",
1964+
page="2d-index", pkg_version="17.0")
1965+
```
1966+
1967+
### Verifying APIs Across Unity Versions
1968+
1969+
```python
1970+
# Specify Unity version for version-specific docs
1971+
unity_docs(action="get_doc", class_name="Camera", member_name="main", version="6000.0.38f1")
1972+
1973+
# Use reflection to check what's actually available in the running editor
1974+
unity_reflect(action="search", query="InputAction", scope="packages")
1975+
```
1976+
1977+
---
1978+
19051979
## Batch Operations
19061980

19071981
### Batch Discovery (Multi-Search)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<details>
2121
<summary><strong>Recent Updates</strong></summary>
2222

23-
* **v9.5.4 (beta)** — New `manage_packages` tool: install, remove, search, and manage Unity packages and scoped registries. Includes input validation, dependency checks on removal, and git URL warnings.
23+
* **v9.5.4 (beta)** — New `unity_reflect` and `unity_docs` tools for API verification: inspect live C# APIs via reflection and fetch official Unity documentation (ScriptReference, Manual, package docs). New `manage_packages` tool: install, remove, search, and manage Unity packages and scoped registries. Includes input validation, dependency checks on removal, and git URL warnings.
2424
* **v9.5.3** — New `manage_graphics` tool (33 actions): volume/post-processing, light baking, rendering stats, pipeline settings, URP renderer features. 3 new resources: `volumes`, `rendering_stats`, `renderer_features`.
2525
* **v9.5.2** — New `manage_camera` tool with Cinemachine support (presets, priority, noise, blending, extensions), `cameras` resource, priority persistence fix via SerializedProperty.
2626
* **v9.4.8** — New editor UI, real-time tool toggling via `manage_tools`, skill sync window, multi-view screenshot, one-click Roslyn installer, Qwen Code & Gemini CLI clients, ProBuilder mesh editing via `manage_probuilder`.
@@ -94,7 +94,7 @@ openupm add com.coplaydev.unity-mcp
9494
* **Extensible** — Works with various MCP Clients
9595

9696
### Available Tools
97-
`apply_text_edits``batch_execute``create_script``debug_request_context``delete_script``execute_custom_tool``execute_menu_item``find_gameobjects``find_in_file``get_sha``get_test_job``manage_animation``manage_asset``manage_camera``manage_components``manage_editor``manage_gameobject``manage_graphics``manage_material``manage_packages``manage_prefabs``manage_probuilder``manage_scene``manage_script``manage_script_capabilities``manage_scriptable_object``manage_shader``manage_texture``manage_tools``manage_ui``manage_vfx``read_console``refresh_unity``run_tests``script_apply_edits``set_active_instance``validate_script`
97+
`apply_text_edits``batch_execute``create_script``debug_request_context``delete_script``execute_custom_tool``execute_menu_item``find_gameobjects``find_in_file``get_sha``get_test_job``manage_animation``manage_asset``manage_camera``manage_components``manage_editor``manage_gameobject``manage_graphics``manage_material``manage_packages``manage_prefabs``manage_probuilder``manage_scene``manage_script``manage_script_capabilities``manage_scriptable_object``manage_shader``manage_texture``manage_tools``manage_ui``manage_vfx` `read_console``refresh_unity``run_tests``script_apply_edits``set_active_instance``unity_docs``unity_reflect``validate_script`
9898

9999
### Available Resources
100100
`cameras``custom_tools``renderer_features``rendering_stats``volumes``editor_active_tool``editor_prefab_stage``editor_selection``editor_state``editor_windows``gameobject``gameobject_api``gameobject_component``gameobject_components``get_tests``get_tests_for_mode``menu_items``prefab_api``prefab_hierarchy``prefab_info``project_info``project_layers``project_tags``tool_groups``unity_instances`

docs/i18n/README-zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<details>
2121
<summary><strong>最近更新</strong></summary>
2222

23-
* **v9.5.4 (beta)** — 新增 `manage_packages` 工具:安装、移除、搜索和管理 Unity 包及作用域注册表。包含输入验证、移除时依赖检查和 git URL 警告。
23+
* **v9.5.4 (beta)** — 新增 `unity_reflect``unity_docs` 工具用于 API 验证:通过反射检查实时 C# API,获取官方 Unity 文档(ScriptReference、Manual、包文档)。新增 `manage_packages` 工具:安装、移除、搜索和管理 Unity 包及作用域注册表。包含输入验证、移除时依赖检查和 git URL 警告。
2424
* **v9.5.3** — 新增 `manage_graphics` 工具(33个操作):体积/后处理、光照烘焙、渲染统计、管线设置、URP渲染器特性。3个新资源:`volumes``rendering_stats``renderer_features`
2525
* **v9.5.2** — 新增 `manage_camera` 工具,支持 Cinemachine(预设、优先级、噪声、混合、扩展)、`cameras` 资源、通过 SerializedProperty 修复优先级持久化问题。
2626
* **v9.4.8** — 新编辑器 UI、通过 `manage_tools` 实时切换工具、技能同步窗口、多视图截图、一键 Roslyn 安装器、支持 Qwen Code 与 Gemini CLI 客户端、通过 `manage_probuilder` 进行 ProBuilder 网格编辑。
@@ -94,7 +94,7 @@ openupm add com.coplaydev.unity-mcp
9494
* **可扩展** — 可与多种 MCP Client 配合使用
9595

9696
### 可用工具
97-
`apply_text_edits``batch_execute``create_script``debug_request_context``delete_script``execute_custom_tool``execute_menu_item``find_gameobjects``find_in_file``get_sha``get_test_job``manage_animation``manage_asset``manage_camera``manage_components``manage_editor``manage_gameobject``manage_graphics``manage_material``manage_packages``manage_prefabs``manage_probuilder``manage_scene``manage_script``manage_script_capabilities``manage_scriptable_object``manage_shader``manage_texture``manage_tools``manage_ui``manage_vfx``read_console``refresh_unity``run_tests``script_apply_edits``set_active_instance``validate_script`
97+
`apply_text_edits``batch_execute``create_script``debug_request_context``delete_script``execute_custom_tool``execute_menu_item``find_gameobjects``find_in_file``get_sha``get_test_job``manage_animation``manage_asset``manage_camera``manage_components``manage_editor``manage_gameobject``manage_graphics``manage_material``manage_packages``manage_prefabs``manage_probuilder``manage_scene``manage_script``manage_script_capabilities``manage_scriptable_object``manage_shader``manage_texture``manage_tools``manage_ui``manage_vfx` `read_console``refresh_unity``run_tests``script_apply_edits``set_active_instance``unity_docs``unity_reflect``validate_script`
9898

9999
### 可用资源
100100
`cameras``custom_tools``renderer_features``rendering_stats``volumes``editor_active_tool``editor_prefab_stage``editor_selection``editor_state``editor_windows``gameobject``gameobject_api``gameobject_component``gameobject_components``get_tests``get_tests_for_mode``menu_items``prefab_api``prefab_hierarchy``prefab_info``project_info``project_layers``project_tags``tool_groups``unity_instances`

manifest.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@
173173
"name": "set_active_instance",
174174
"description": "Set the active Unity Editor instance for multi-instance workflows"
175175
},
176+
{
177+
"name": "unity_docs",
178+
"description": "Fetch Unity documentation (ScriptReference, Manual, package docs)"
179+
},
180+
{
181+
"name": "unity_reflect",
182+
"description": "Inspect Unity C# APIs via live reflection"
183+
},
176184
{
177185
"name": "validate_script",
178186
"description": "Validate C# script syntax and compilation"

unity-mcp-skill/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ uri="file:///full/path/to/file.cs"
190190
| **Packages** | `manage_packages` | Install, remove, search, and manage Unity packages and scoped registries. Query actions: list installed, search registry, get info, ping, poll status. Mutating actions: add/remove packages, embed for editing, add/remove scoped registries, force resolve. Validates identifiers, warns on git URLs, checks dependents before removal (`force=true` to override). See [tools-reference.md](references/tools-reference.md#package-tools). |
191191
| **ProBuilder** | `manage_probuilder` | 3D modeling, mesh editing, complex geometry. **When `com.unity.probuilder` is installed, prefer ProBuilder shapes over primitive GameObjects** for editable geometry, multi-material faces, or complex shapes. Supports 12 shape types, face/edge/vertex editing, smoothing, and per-face materials. See [ProBuilder Guide](references/probuilder-guide.md). |
192192
| **UI** | `manage_ui`, `batch_execute` with `manage_gameobject` + `manage_components` | **UI Toolkit**: Use `manage_ui` to create UXML/USS files, attach UIDocument, inspect visual trees. **uGUI (Canvas)**: Use `batch_execute` for Canvas, Panel, Button, Text, Slider, Toggle, Input Field. **Read `mcpforunity://project/info` first** to detect uGUI/TMP/Input System/UI Toolkit availability. (see [UI workflows](references/workflows.md#ui-creation-workflows)) |
193+
| **Docs** | `unity_reflect`, `unity_docs` | API verification and documentation lookup. **`unity_reflect`** inspects live C# APIs via reflection (requires Unity connection): `search` types across assemblies, `get_type` for member summary, `get_member` for full signatures. **`unity_docs`** fetches official docs from docs.unity3d.com (no Unity connection needed): `get_doc` (ScriptReference), `get_manual` (Manual pages), `get_package_doc` (package docs), `lookup` (parallel search all sources + project assets). **Trust hierarchy: reflection > project assets > docs.** Workflow: `unity_reflect` search -> get_type -> get_member -> `unity_docs` lookup. See [tools-reference.md](references/tools-reference.md#docs-tools). |
193194

194195
## Common Workflows
195196

0 commit comments

Comments
 (0)