unity-mcp/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools
dsarno 5511a2b8ad
🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519)
* feat: Redesign GameObject API for better LLM ergonomics

- find_gameobjects: Search GameObjects, returns paginated instance IDs only
- manage_components: Component lifecycle (add, remove, set_property)

- unity://scene/gameobject/{id}: Single GameObject data (no component serialization)
- unity://scene/gameobject/{id}/components: All components (paginated)
- unity://scene/gameobject/{id}/component/{name}: Single component by type

- manage_scene get_hierarchy: Now includes componentTypes array
- manage_gameobject: Slimmed to lifecycle only (create, modify, delete)
  - Legacy actions (find, get_components, etc.) log deprecation warnings

- ParamCoercion: Centralized int/bool/float/string coercion
- VectorParsing: Vector3/Vector2/Quaternion/Color parsing
- GameObjectLookup: Centralized GameObject search logic

- 76 new Unity EditMode tests for ManageGameObject actions
- 21 new pytest tests for Python tools/resources
- New NL/T CI suite for GameObject API (GO-0 to GO-5)

Addresses LLM confusion with parameter overload by splitting into
focused tools and read-only resources.

* feat: Add GameObject API stress tests and NL/T suite updates

Stress Tests (12 new tests):
- BulkCreate small/medium batches
- FindGameObjects pagination with by_component search
- AddComponents to single object
- GetComponents with full serialization
- SetComponentProperties (complex Rigidbody)
- Deep hierarchy creation and path lookup
- GetHierarchy with large scenes
- Resource read performance tests
- RapidFire create-modify-delete cycles

NL/T Suite Updates:
- Added GO-0..GO-10 tests in nl-gameobject-suite.md
- Fixed tool naming: mcp__unity__ → mcp__UnityMCP__

Other:
- Fixed LongUnityScriptClaudeTest.cs compilation errors
- Added reports/, .claude/local/, scripts/local-test/ to .gitignore

All 254 EditMode tests pass (250 run, 4 explicit skips)

* fix: Address code review feedback

- ParamCoercion: Use CultureInfo.InvariantCulture for float parsing
- ManageComponents: Move Transform removal check before GetComponent
- ManageGameObjectFindTests: Use try-finally for LogAssert.ignoreFailingMessages
- VectorParsing: Document that quaternions are not auto-normalized
- gameobject.py: Prefix unused ctx parameter with underscore

* fix: Address more code review feedback

NL/T Prompt Fixes:
- nl-gameobject-suite.md: Remove non-existent list_resources/read_resource from AllowedTools
- nl-gameobject-suite.md: Fix parameter names (component_type, properties)
- nl-unity-suite-nl.md: Remove unused manage_editor from AllowedTools

Test Fixes:
- GameObjectAPIStressTests: Add null check to ToJObject helper
- GameObjectAPIStressTests: Clarify AudioSource usage comment
- ManageGameObjectFindTests: Use built-in 'UI' layer instead of 'Water'
- LongUnityScriptClaudeTest: Clean up NL/T test artifacts (Counte42 typo, HasTarget)

* docs: update README tools and resources lists

- Add missing tools: manage_components, batch_execute, find_gameobjects, refresh_unity
- Add missing resources: gameobject_api, editor_state_v2
- Make descriptions more concise across all tools and resources
- Ensure documentation matches current MCP server functionality

* chore: Remove accidentally committed test artifacts

- Remove Materials folder (40 .mat files from interactive testing)
- Remove Shaders folder (5 noise shaders from testing)
- Remove test scripts (Bounce*, CylinderBounce* from testing)
- Remove Temp.meta and commit.sh

* refactor: remove deprecated manage_gameobject actions

- Remove deprecated switch cases: find, get_components, get_component, add_component, remove_component, set_component_property
- Remove deprecated wrapper methods (423 lines deleted from ManageGameObject.cs)
- Delete ManageGameObjectFindTests.cs (tests deprecated 'find' action)
- Remove deprecated test methods from ManageGameObjectTests.cs
- Add GameObject resource URIs to README documentation
- Add batch_execute performance tips to README, tool description, and gameobject_api resource
- Enhance batch_execute description to emphasize 10-100x performance gains

Total: ~1200 lines removed. New API (find_gameobjects, manage_components, resources) is the recommended path forward.

* refactor: consolidate shared services across MCP tools

Major architectural improvements:
- Create UnityJsonSerializer for shared JSON/Unity type conversion
- Create ObjectResolver for unified object resolution (GameObjects, Components, Assets)
- Create UnityTypeResolver for consolidated type resolution with caching
- Create PropertyConversion for unified JSON→Unity property conversion
- Create ComponentOps for low-level component operations
- Create Pagination helpers for standardized pagination across tools

Tool simplifications:
- ManageGameObject: Remove 68-line prefab redirect anti-pattern, delegate to helpers
- ManageAsset: Remove ~80 lines duplicate ConvertJTokenToType
- ManageScriptableObject: Remove ~40 lines duplicate ResolveType
- ManageComponents: Use ComponentOps, UnityTypeResolver (~90 lines saved)
- ManageMaterial: Standardize to SuccessResponse/ErrorResponse patterns
- FindGameObjects: Use PaginationRequest/PaginationResponse
- GameObjectLookup: FindComponentType delegates to UnityTypeResolver

Tests: 242/246 passed, 4 skipped (expected)

* Apply code review feedback: consolidate utilities and improve compatibility

Python Server:
- Extract normalize_properties() to shared utils.py (removes duplication)
- Move search_term validation before preflight() for fail-fast
- Fix manage_script.py documentation (remove incorrect 'update' reference)
- Remove stale comments in execute_menu_item.py, manage_editor.py
- Remove misleading destructiveHint from manage_shader.py

C# Unity:
- Add Vector4Converter (commonly used, was missing)
- Fix Unity 2021 compatibility: replace FindObjectsByType with FindObjectsOfType
- Add path normalization in ObjectResolver before StartsWith check
- Improve ComponentOps.SetProperty conversion error detection
- Add Undo.RecordObject in ManageComponents before property modifications
- Improve error message clarity in ManageMaterial.cs
- Add defensive error handling to stress test ToJObject helper
- Increase CI timeout thresholds for test stability

GitHub Workflows:
- Fix GO test sorting in markdown output (GO-10 now sorts after GO-9)
- Add warning logging for fragment parsing errors

* Fix animator hash names in test fixture to match parameter names

BlendXHash/BlendYHash now use 'reachX'/'reachY' to match the
actual animator parameter names.

* fix(windows): improve HTTP server detection and auto-start reliability

- Fix netstat detection on Windows by running netstat.exe directly instead
  of piping through findstr (findstr returns exit code 1 when no matches,
  causing false detection failures)
- Increase auto-start retry attempts (20→30) and delays (2s→3s) to handle
  slow server starts during first install, version upgrades, and dev mode
- Only attempt blind connection after 20 failed detection attempts to reduce
  connection error spam during server startup
- Remove verbose debug logs that were spamming the console every frame

* fix: auto-create tags and remove deprecated manage_gameobject actions

- ManageGameObject.cs: Check tag existence before setting; auto-create
  undefined tags using InternalEditorUtility.AddTag() instead of relying
  on exception handling (Unity logs warning, doesn't throw)
- manage_gameobject.py: Remove deprecated actions (find, get_components,
  add_component, remove_component, set_component_property, get_component)
  from Literal type - these are now handled by find_gameobjects and
  manage_components tools
- Update test suite and unit tests to reflect new auto-create behavior

* fix: address code review feedback

Bug fixes:
- Fix searchInactive flag ignored in FindObjectsOfType (use includeInactive overload)
- Fix property lookup to try both original and normalized names for backwards compat
- Remove dead code for deprecated 'find' action validation
- Update error message to list only valid actions

Improvements:
- Add destructiveHint=True to manage_shader tool
- Limit fallback connection attempts (every 3rd attempt) to avoid spamming errors
- Consolidate PropertyConversion exception handlers to single catch block
- Add tag existence assertion and cleanup in tag auto-creation tests

Test fixes:
- Update SetComponentProperties_ContinuesAfterException log regex for new error format
- Update test_manage_gameobject_param_coercion to test valid actions only
2026-01-06 12:58:17 -08:00
..
Fixtures feature/Add new manage_scriptable_object tool (#489) 2025-12-28 20:15:50 -08:00
AIPropertyMatchingTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
AIPropertyMatchingTests.cs.meta Allow the LLMs to read menu items, not just execute them (#263) 2025-09-12 11:19:58 -04:00
CommandRegistryTests.cs Move Get commands to editor resources + Run Python tests every update (#368) 2025-11-05 16:06:48 -04:00
CommandRegistryTests.cs.meta Improve Windsurf MCP Config (#231) 2025-08-24 06:57:11 -04:00
ComponentResolverTests.cs Move Get commands to editor resources + Run Python tests every update (#368) 2025-11-05 16:06:48 -04:00
ComponentResolverTests.cs.meta Allow the LLMs to read menu items, not just execute them (#263) 2025-09-12 11:19:58 -04:00
DomainReloadResilienceTests.cs Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
DomainReloadResilienceTests.cs.meta HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
ExecuteMenuItemTests.cs Add testing and move menu items to resources (#316) 2025-10-13 11:16:43 -04:00
ExecuteMenuItemTests.cs.meta Add testing and move menu items to resources (#316) 2025-10-13 11:16:43 -04:00
Fixtures.meta feature/Add new manage_scriptable_object tool (#489) 2025-12-28 20:15:50 -08:00
GameObjectAPIStressTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
GameObjectAPIStressTests.cs.meta 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
MCPToolParameterTests.cs Feature/run tests summary clean (#501) 2026-01-01 20:36:45 -08:00
MCPToolParameterTests.cs.meta Feature/run tests summary clean (#501) 2026-01-01 20:36:45 -08:00
ManageGameObjectCreateTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
ManageGameObjectCreateTests.cs.meta 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
ManageGameObjectDeleteTests.cs 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
ManageGameObjectDeleteTests.cs.meta 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
ManageGameObjectModifyTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
ManageGameObjectModifyTests.cs.meta 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
ManageGameObjectTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
ManageGameObjectTests.cs.meta Allow the LLMs to read menu items, not just execute them (#263) 2025-09-12 11:19:58 -04:00
ManageMaterialPropertiesTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
ManageMaterialPropertiesTests.cs.meta feat: Add `manage_material` tool for dedicated material manipulation (#440) 2025-12-07 19:39:52 -08:00
ManageMaterialReproTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
ManageMaterialReproTests.cs.meta feat: Add `manage_material` tool for dedicated material manipulation (#440) 2025-12-07 19:39:52 -08:00
ManageMaterialStressTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
ManageMaterialStressTests.cs.meta feat: Add `manage_material` tool for dedicated material manipulation (#440) 2025-12-07 19:39:52 -08:00
ManageMaterialTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
ManageMaterialTests.cs.meta feat: Add `manage_material` tool for dedicated material manipulation (#440) 2025-12-07 19:39:52 -08:00
ManagePrefabsTests.cs HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
ManagePrefabsTests.cs.meta Open and close prefabs in the stage view + create them (#283) 2025-09-26 19:28:56 -04:00
ManageSceneHierarchyPagingTests.cs Payload-safe paging for hierarchy/components + safer asset search + docs (#490) 2025-12-28 20:57:57 -08:00
ManageSceneHierarchyPagingTests.cs.meta Payload-safe paging for hierarchy/components + safer asset search + docs (#490) 2025-12-28 20:57:57 -08:00
ManageScriptValidationTests.cs Autoformat (#297) 2025-09-30 16:25:33 -04:00
ManageScriptValidationTests.cs.meta fix: address CodeRabbit and Greptile feedback 2025-09-03 16:37:45 -07:00
ManageScriptableObjectTests.cs Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
ManageScriptableObjectTests.cs.meta feature/Add new manage_scriptable_object tool (#489) 2025-12-28 20:15:50 -08:00
MaterialDirectPropertiesTests.cs HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
MaterialDirectPropertiesTests.cs.meta Material tools: support direct shader property keys + add EditMode coverage (#344) 2025-10-23 18:25:29 -07:00
MaterialMeshInstantiationTests.cs Move Get commands to editor resources + Run Python tests every update (#368) 2025-11-05 16:06:48 -04:00
MaterialMeshInstantiationTests.cs.meta test: Consolidate pytest suite to MCPForUnity and improve test infrastructure (#332) 2025-10-21 10:42:55 -07:00
MaterialParameterToolTests.cs 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
MaterialParameterToolTests.cs.meta Harden MCP tool parameter handling + add material workflow tests (TDD) (#343) 2025-10-23 17:57:27 -07:00
ReadConsoleTests.cs Codex/optimize and paginate read console tool (#511) 2026-01-04 14:46:52 -08:00
ReadConsoleTests.cs.meta feat: Add `manage_material` tool for dedicated material manipulation (#440) 2025-12-07 19:39:52 -08:00
RunTestsTests.cs Feature/run tests summary clean (#501) 2026-01-01 20:36:45 -08:00
RunTestsTests.cs.meta Feature/run tests summary clean (#501) 2026-01-01 20:36:45 -08:00