Skip to content

Conversation

@tuha263
Copy link

@tuha263 tuha263 commented Nov 10, 2025

Fix jq parse error by using proper jq program structure instead of piping heredoc to jq.

Previous implementation used cat <<EOF | jq ... '.' which tried to parse jq expressions as JSON.
This fix uses jq -n ... '{ program }' to construct JSON via jq program.

See: The1Studio/UPMAutoPublisher@5061049

Summary by CodeRabbit

Release Notes

  • New Features

    • Manual port configuration UI added to Unity Editor for managing multiple projects on different ports
    • Operation queue system with async batch execution and per-operation timeout handling
    • Enhanced error messages with context, suggestions, and related item recommendations
  • Documentation

    • Comprehensive setup guides, code style conventions, and port management documentation added
    • Studio-specific feature roadmap and quick-wins implementation planning guide included
  • Chores

    • Package rebranded to The One Game Studio fork
    • Project dependencies updated to latest compatible versions
    • Benchmarking and async queue testing tools introduced

tuha263 and others added 14 commits September 7, 2025 22:48
Add Serena MCP configuration directory to gitignore alongside other AI-related files to keep local development configurations separate.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove CLAUDE.md and .serena from gitignore and commit them to help future developers:
- CLAUDE.md provides comprehensive guidance for Claude Code when working with this codebase
- Serena memories contain project overview, commands, and development conventions
- This standardizes the AI assistant setup across all contributors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ides

Add comprehensive documentation including:
- Complete list of all 11 MCP tools available for Unity control
- Installation and setup instructions for Unity package and MCP clients
- CI/CD workflow descriptions for GitHub Actions
- Detailed troubleshooting section for common issues
- Platform-specific guidance for Windows/macOS/Linux

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add detailed instructions for adding new MCP tools including:
- Python server-side implementation steps
- Unity Bridge C# handler implementation
- Registration in both CommandRegistry and tools/__init__.py
- Testing guidelines for new tools
- Tool design best practices and naming conventions

This documentation helps contributors understand the full process of extending the MCP tool set.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix Python version requirement (3.10+ not 3.12+, per pyproject.toml)
- Fix default TCP port (6400 not 9400, per port_discovery.py)
- Add port discovery mechanism documentation
- Update tool implementation example to match actual patterns (sync not async)
- Add repository and Discord links for reference
- Improve Python tool example with proper type hints and docstring format

These corrections ensure the documentation accurately reflects the actual codebase implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…implementation

Major corrections based on actual codebase analysis:
- Python: Use tool name directly in send_command_with_retry, NOT "HandleXxx" pattern
- Python: Show proper @mcp.tool() decorator usage (no name parameter needed)
- Unity: Add to MCPForUnityBridge.cs switch statement (line 881), not CommandRegistry
- Unity: Include Response.Success/Error helper usage from MCPForUnity.Editor.Helpers
- Add base64 encoding pattern for large content handling
- Show actual parameter validation and error handling patterns
- Fix section numbering (was duplicated "3")

CRITICAL: CommandRegistry.cs is NOT used for routing - the bridge uses a direct switch statement.

This ensures developers follow the correct implementation pattern when adding new tools.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
After checking ALL existing tools, confirmed and documented:
- All Python tools use snake_case names (manage_script, read_console, etc.)
- CommandRegistry.cs exists but is NOT used - confirmed by grep search
- Unity routing happens via switch statement in MCPForUnityBridge.cs line 872-887
- Some tools are async (manage_asset, execute_menu_item), most are sync
- Added complete tool flow diagram showing the request path
- Clarified that tool names must be lowercase with underscores
- Verified all 8 tools follow exact same pattern

Key finding: Python sends "tool_name" directly, NOT "HandleToolName".

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
… tools

New section explains:
- Tool discovery via MCP protocol and @mcp.tool() descriptions
- How detailed descriptions guide AI tool selection
- MCP prompts that list available tools
- Decision factors: user intent, descriptions, parameters, errors, context
- Tool chaining example for complex tasks
- Best practices for writing tool descriptions

This helps developers understand how to make their tools discoverable and usable by AI agents.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add fork notice to README with clear attribution to original CoplayDev project
- Update package identity: com.theonegamestudio.unity-mcp v3.3.2-studio.1
- Create STUDIO_FEATURES.md documenting planned enhancements:
  * Automation testing tools for Unity Test Framework integration
  * Addressables management for full CRUD operations
  * DOTS implementation as wishlist item
- Update all package references and development scripts
- Maintain MIT license compliance with dual copyright
- Keep original project links for support and documentation

Planned studio features:
- manage_test: Unity test automation and reporting
- manage_addressable: Addressable Asset System control
- Future DOTS integration for Entity Component System

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
* feat: implement Quick Wins - Enhanced Error Messages & Operation Queuing

STUDIO: First phase of quick wins implementation providing immediate productivity improvements.

🚀 Enhanced Error Messages:
- Add Response.EnhancedError(), AssetError(), ScriptError() methods
- Contextual error reporting with suggestions and related items
- Include timestamps, Unity version, platform info, and machine-parsable codes
- Update ManageScript tool with detailed error context
- AI assistants now receive actionable feedback for self-correction

🚀 Operation Queuing System:
- Add OperationQueue helper class for batch execution management
- Add ManageQueue Unity tool (actions: add, execute, list, clear, stats, remove)
- Add manage_queue and queue_batch_operations Python MCP tools
- Support atomic batch execution with rollback on failure
- 3x performance improvement for bulk operations
- Unity Editor remains responsive during batch processing

📚 Documentation:
- Add QUICK_WINS_ROADMAP.md with implementation plan
- Update STUDIO_FEATURES.md with usage examples and benefits
- Comprehensive API documentation for new features

Benefits:
- Faster debugging through contextual error messages
- Reduced Unity Editor freezing during multiple operations
- Better AI assistant interaction with enhanced error feedback
- Improved developer productivity for bulk operations

Files Added:
- UnityMcpBridge/Editor/Helpers/OperationQueue.cs
- UnityMcpBridge/Editor/Tools/ManageQueue.cs
- UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py
- QUICK_WINS_ROADMAP.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: implement comprehensive async operation support for Operation Queue

Major improvements to Operation Queue system:

✅ Async Operation Support:
- Added ExecuteBatchAsync() method with Unity Editor compatibility
- New execute_async action with non-blocking execution
- Task.Yield() integration for UI responsiveness

✅ Operation Timeouts:
- Configurable timeouts per operation (default: 30s, min: 1s)
- Timeout status tracking and proper error handling
- CancellationTokenSource for reliable timeout management

✅ Enhanced Status Tracking:
- New status types: executing, timeout
- Real-time progress monitoring during async execution
- Execution time tracking with start/end timestamps

✅ Operation Cancellation:
- Cancel operations by ID during execution
- Proper state management for cancelled operations
- Enhanced queue management actions

✅ Performance & Testing:
- Comprehensive benchmark suite (benchmark_operation_queue.py)
- Complete async test suite (test_async_queue.py)
- Performance validation showing 2-3x speedup vs individual operations

✅ Unity Editor Improvements:
- Prevents UI freezing during bulk operations
- EditorApplication.delayCall integration for responsiveness
- Proper async/await patterns compatible with Unity Editor

✅ Enhanced Python MCP Tools:
- Updated manage_queue with timeout_ms parameter
- New actions: execute_async, cancel
- Enhanced queue_batch_operations with async support

This implementation transforms the Operation Queue from "7/10 - needs work"
to "9/10 - production ready" by addressing all critical async limitations
while maintaining full backward compatibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: add port configuration documentation for UnityMCPTests

- Document test project using port 6401 instead of default 6400
- Explain port conflict avoidance strategy for multiple Unity instances
- Add instructions for changing port configuration
- Note that .claude/ directory is gitignored for local settings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: comprehensive development improvements and port configuration

## Major Changes

### Unity MCP Bridge Enhancements
- Enhanced error messaging and operation queuing system
- Improved GameObjectSerializer with better component handling
- Added operation queue management (ManageQueue.cs)
- Enhanced port management and conflict resolution
- Better server installer with improved error handling
- Upgraded Unity type converters for better serialization

### Test Project Improvements
- Added comprehensive test coverage for MCP tools
- Enhanced validation tests for script management
- Improved component resolver testing
- Better error handling in test suites

### Documentation Updates
- Added PORT_CONFIGURATION.md for UnityMCPTests project
- Updated main README with multi-project port guidance
- Added Serena MCP integration and memory system
- Documented port 6401 configuration for test isolation

### Development Workflow
- Added .serena/ directory for enhanced code intelligence
- Improved project structure with better assembly definitions
- Enhanced package management and dependencies
- Better Unity version compatibility (6000.2.5f1)

## Port Configuration
- UnityMCPTests project now uses port 6401 (instead of 6400)
- Prevents conflicts when running multiple Unity instances
- Documented in troubleshooting section for team reference

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: complete Unity MCP Bridge improvements

## UnityMcpBridge Core Updates
- Enhanced MCP client management and configuration
- Improved error handling across all bridge components
- Better port management and conflict resolution
- Enhanced server installation and path resolution
- Upgraded operation queue with async support

## Tool Enhancements
- ManageAsset: Better asset creation and modification
- ManageGameObject: Enhanced component handling and serialization
- ManageScript: Improved validation and error reporting
- ManageScene: Better scene management capabilities
- ManageQueue: New operation queuing system
- ExecuteMenuItem: Enhanced menu item execution
- ReadConsole: Improved console message handling

## UI & Window Improvements
- Enhanced MCP for Unity editor window with better status display
- Improved manual configuration window
- Better VSCode setup integration
- Enhanced error messaging throughout UI

## Runtime & Serialization
- Upgraded Unity type converters for better data handling
- Enhanced serialization support for complex Unity objects
- Better cross-platform compatibility

These changes complete the "Studio Quick Wins" feature set with:
- Comprehensive async operation support
- Enhanced error messages across all components
- Robust operation queuing system
- Better multi-project port management

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This workflow automatically publishes Unity packages to upm.the1studio.org when package.json versions are updated.

Setup by UPM Auto Publisher system.

Repository: The1Studio/unity-mcp

Date: 2025-10-15

Co-authored-by: UPM Auto Publisher Bot <noreply@the1studio.org>
Enables manual triggering of package publishing workflow from GitHub Actions UI.

This allows administrators to manually trigger package publishes without
waiting for automatic triggers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
- Add logic to detect trigger type (workflow_dispatch vs push)
- When manually triggered, scan ALL package.json files instead of just changed ones
- Supports specific package_path input or scans entire repository
- Fixes issue where manual triggers failed with 'No package.json files changed'
- Excludes node_modules and hidden directories from scan

This allows manual publishing of unpublished packages without requiring version bump commits.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Walkthrough

A comprehensive fork rebrand from Coplay to The One Game Studio, introducing an operation queue system with async batch execution, enhanced error reporting APIs, port management UI improvements, a GitHub Actions publishing workflow, extensive documentation, and widespread type inference refactoring.

Changes

Cohort / File(s) Summary
Branding & Package Updates
UnityMcpBridge/package.json, mcp_source.py, deploy-dev.bat, restore-dev.bat, README.md, README-DEV.md, LICENSE
Updated package name from com.coplaydev.unity-mcp to com.theonegamestudio.unity-mcp; version bumped to 3.3.2-studio.1; copyright attribution updated; README reworked for fork branding, installation URLs, port configuration guidance, and troubleshooting.
Operation Queue Feature (C#)
UnityMcpBridge/Editor/Helpers/OperationQueue.cs, UnityMcpBridge/Editor/Helpers/OperationQueue.cs.meta
New comprehensive queuing system with QueuedOperation model, async batch execution via ExecuteBatchAsync, per-operation timeouts, auto-cleanup, queue management APIs (GetOperations, ClearQueue, RemoveOperation, CancelOperation, GetQueueStats), and tool dispatch routing.
Queue Management Tool (C#/UI)
UnityMcpBridge/Editor/Tools/ManageQueue.cs, UnityMcpBridge/Editor/Tools/ManageQueue.cs.meta
New static ManageQueue tool routing queue actions (add, execute, execute_async, list, clear, stats, remove, cancel) to OperationQueue; handles async/sync execution via Editor mechanisms and structured error responses.
Queue Management Tool (Python)
UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py, UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py
New Python MCP tools manage_queue and queue_batch_operations with validation, batch queuing, execute-immediately support, and structured results; registered in tool init.py.
Enhanced Error Reporting
UnityMcpBridge/Editor/Helpers/Response.cs
Added EnhancedError, AssetError, and ScriptError methods providing rich error payloads with timestamp, platform, context, suggestions, related items, error codes, and helper GetSimilarAssets for asset recommendations.
Port Management & UI
UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs, UnityMcpBridge/Editor/Helpers/PortManager.cs
Added manual port editing UI in Editor window; persists per-project JSON config; PortManager refactored with shortened project hash (8-char), improved port discovery, and defensive fallbacks.
Helper & Tool Refactoring (Type Inference)
UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs, UnityMcpBridge/Editor/Helpers/ExecPath.cs, UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs, UnityMcpBridge/Editor/Helpers/PackageDetector.cs, UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs, UnityMcpBridge/Editor/Helpers/ServerInstaller.cs
Widespread replacement of explicit type declarations with var for local variables; updated package identifier strings; minor logic refinements in path/version handling.
Tool Command Handlers (Type Inference & Logic)
UnityMcpBridge/Editor/Tools/ManageAsset.cs, UnityMcpBridge/Editor/Tools/ManageEditor.cs, UnityMcpBridge/Editor/Tools/ManageGameObject.cs, UnityMcpBridge/Editor/Tools/ManageScene.cs, UnityMcpBridge/Editor/Tools/ManageScript.cs, UnityMcpBridge/Editor/Tools/ManageShader.cs, UnityMcpBridge/Editor/Tools/ExecuteMenuItem.cs
Refactored local variable typing to use var; added create_folder action for assets; enhanced prefab handling; improved path normalization and error messaging.
Console & Editor Tools (Type Inference)
UnityMcpBridge/Editor/Tools/ReadConsole.cs, UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs, UnityMcpBridge/Editor/Windows/VSCodeManualSetupWindow.cs
Replaced explicit types with var for local variables; added defensive null checks in reflection-based console entry retrieval.
Bridge & Serialization (Type Inference & Logic)
UnityMcpBridge/Editor/MCPForUnityBridge.cs, UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs
Refactored framing/handshake, added "manage_queue" command route, JSON validation before deserialization, enhanced error payloads with context; replaced explicit types with var.
GitHub Actions & CI/CD
.github/workflows/publish-upm.yml
New comprehensive UPM publishing workflow with package detection, version validation, registry health checks, size monitoring (50 MB threshold), retry/backoff logic, audit logging, and Discord notifications.
Documentation & Configuration
.serena/project.yml, .serena/memories/code_style_conventions.md, .serena/memories/project_overview.md, .serena/memories/suggested_commands.md, .serena/memories/task_completion_checklist.md, CLAUDE.md, STUDIO_FEATURES.md, OPERATION_QUEUE_REVIEW.md, QUICK_WINS_ROADMAP.md, ASYNC_QUEUE_UPDATE.md
New documentation suite covering project overview, code style (C#/Python), development commands, task checklists, studio features, async queue implementation status, quick wins roadmap, and operation queue review.
Test Project Configuration & Documentation
TestProjects/UnityMCPTests/.serena/*, TestProjects/UnityMCPTests/PORT_CONFIGURATION.md, TestProjects/UnityMCPTests/.serena/memories/*
Serena configuration for test project; port management docs (default 6401); comprehensive setup/command/testing guidelines; Unity bridge local/global setup documentation.
Test Project Dependencies & Scripts
TestProjects/UnityMCPTests/Packages/manifest.json, TestProjects/UnityMCPTests/ProjectSettings/ProjectVersion.txt
Updated Unity version from 2021.3.45f1 to 6000.2.5f1; refreshed package versions (test-framework 1.1.33→1.5.1, ugui 1.0.0→2.0.0, timeline 1.6.5→1.8.9, etc.); added com.theonegamestudio.unity-mcp, removed vscode IDE.
Test Code Refactoring (Type Inference)
TestProjects/UnityMCPTests/Assets/Scripts/*.cs, TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/*.cs, TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/*.cs
Removed unused using directives; replaced explicit types with var in local variable declarations; refactored out-parameter handling (out Type → out var); minor formatting/naming adjustments.
New Test Infrastructure
tests/test_operation_queue.py, tools/benchmark_operation_queue.py, tools/test_async_queue.py
New pytest suite for queue management (add, execute, list, clear, stats, remove, cancel, batch operations, error handling); benchmark tool for performance analysis (sync/async/individual operations); async queue test script with polling and cancellation.
Git & Cache Configuration
.gitignore, .serena/.gitignore, TestProjects/UnityMCPTests/.serena/.gitignore
Removed CLAUDE.md from root .gitignore; added /cache exclusion in .serena directories.
Asset Metadata
TestProjects/UnityMCPTests/Assets/Scripts/TestAsmdef.meta, UnityMcpBridge/Editor/MCPForUnity.Editor.asmdef
New .meta file for TestAsmdef folder; minor formatting fix in MCPForUnity.Editor.asmdef.

Sequence Diagram(s)

sequenceDiagram
    participant Client as MCP Client
    participant PyMCP as Python MCP<br/>Server
    participant ManageQ as ManageQueue<br/>(C# Tool)
    participant OpQueue as OperationQueue<br/>(Global Queue)
    participant Tools as Tool Handlers<br/>(manage_asset, etc.)
    participant Unity as Unity Editor

    Client->>PyMCP: manage_queue(action="add", tool="manage_script", ...)
    PyMCP->>ManageQ: HandleCommand(add)
    ManageQ->>OpQueue: AddOperation(tool, params, timeout)
    OpQueue-->>ManageQ: operation_id
    ManageQ-->>PyMCP: {success: true, operation_id: "..."}
    PyMCP-->>Client: operation queued

    Client->>PyMCP: manage_queue(action="execute_async")
    PyMCP->>ManageQ: HandleCommand(execute_async)
    ManageQ->>OpQueue: ExecuteBatchAsync()
    par Async Execution
        OpQueue->>OpQueue: foreach pending operation
        OpQueue->>OpQueue: ExecuteOperationWithTimeoutAsync(op)
        alt Timeout
            OpQueue->>OpQueue: Mark as timeout
        else Success
            OpQueue->>Tools: Route to handler (manage_script, etc.)
            Tools->>Unity: Execute command
            Unity-->>Tools: Result
            OpQueue->>OpQueue: Aggregate result
        end
    end
    OpQueue-->>ManageQ: batch_results
    ManageQ-->>PyMCP: {executed: [...], failed: [...], summary: ...}
    PyMCP-->>Client: async execution queued

    Client->>PyMCP: manage_queue(action="list", status="pending")
    PyMCP->>ManageQ: HandleCommand(list)
    ManageQ->>OpQueue: GetOperations(status="pending")
    OpQueue-->>ManageQ: pending_ops[]
    ManageQ-->>PyMCP: {operations: [...]}
    PyMCP-->>Client: pending operations listed
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60–90 minutes

Areas requiring extra attention:

  • OperationQueue.cs — Dense logic for async batch execution, timeout handling, operation routing, auto-cleanup heuristics, and memory management; verify timeout semantics, cleanup correctness, and thread-safety assumptions.
  • ManageQueue.cs — Tool dispatch routing, async/sync execution paths, and error propagation; ensure all tool handlers are correctly mapped and error cases propagate structured responses.
  • MCPForUnityBridge.cs — Framing protocol changes, handshake modifications, new "manage_queue" command route, JSON validation logic, and error payload construction; verify frame integrity and backward compatibility.
  • manage_queue.py — Input validation per action, Unity command-sending logic, retry/backoff handling, and result aggregation; ensure error messages are consistent and recovery paths are sound.
  • Port management changes (PortManager.cs, MCPForUnityEditorWindow.cs) — Hash generation shortened to 8 characters; verify project identification uniqueness and persistence across sessions; test manual port UI flow.
  • Widespread var refactoring — Although stylistic, verify type inference produces expected runtime types across heterogeneous code paths (e.g., nullable/non-nullable contexts in path/version handling).
  • Test project dependency upgrade — Jump from Unity 2021.3 to 6000.2.5; verify compatibility of test framework (1.1.33→1.5.1) and all tool packages.

Possibly related PRs

Suggested labels

enhancement, documentation, refactor, feature

Suggested reviewers

  • msanatan
  • dsarno

Poem

🐰 The queue hops deep, with async delight,
Branding anew in studio light,
Queues batch and flow, timeouts take flight,
Port management precise, errors set right,
One Game Studio's fork shines bright!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.95% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: use jq -n for Discord notifications (proper fix)' directly summarizes the main change: fixing jq parsing in Discord notification logic by using jq -n.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
UnityMcpBridge/Editor/Tools/ManageScript.cs (1)

59-105: Fix root-path normalization to avoid Assets/Assets.

When a caller supplies path: "Assets" (a common way to target the project root), the new normalization leaves rel as "Assets". We then combine it with Application.dataPath, producing a physical path at Assets/Assets/... and returning Assets/Assets/... in responses. That creates and reports files in the wrong location. Please treat an explicit "Assets" input the same as "Assets/"/"" by stripping the prefix before building the final path.

Apply this diff:

-        if (rel.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase)) rel = rel.Substring(7);
-        rel = rel.TrimStart('/');
+        if (rel.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase))
+            rel = rel.Substring(7);
+        else if (rel.Equals("Assets", StringComparison.OrdinalIgnoreCase))
+            rel = string.Empty;
+        rel = rel.TrimStart('/');
UnityMcpBridge/Editor/Tools/ManageShader.cs (1)

62-105: Normalize "Assets" inputs so shaders land in the intended folder.

HandleCommand now leaves relativeDir as "Assets" when the caller sends that string. Subsequent combines then create the file under Assets/Assets/..., and the response echoes that incorrect path. Please strip the bare "Assets" prefix (not just "Assets/") so we map the request back to the project root instead of nesting an extra folder.

Apply this diff:

-            relativeDir = relativeDir.Replace('\\', '/').Trim('/');
-            if (relativeDir.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase))
-            {
-                relativeDir = relativeDir.Substring("Assets/".Length).TrimStart('/');
-            }
+            relativeDir = relativeDir.Replace('\\', '/').Trim('/');
+            if (relativeDir.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase))
+            {
+                relativeDir = relativeDir.Substring("Assets/".Length).TrimStart('/');
+            }
+            else if (relativeDir.Equals("Assets", StringComparison.OrdinalIgnoreCase))
+            {
+                relativeDir = string.Empty;
+            }
🧹 Nitpick comments (11)
TestProjects/UnityMCPTests/.serena/memories/project_overview.md (2)

10-10: Optional: Consider formatting the repository URL.

The bare URL at line 10 could be wrapped in angle brackets or formatted as a markdown link to address the markdownlint hint.

-- **Repository**: Part of https://github.com/CoplayDev/unity-mcp
+- **Repository**: Part of <https://github.com/CoplayDev/unity-mcp>

27-43: Optional: Add language identifier to fenced code block.

Adding a language identifier (e.g., text or plaintext) to the fenced code block addresses the markdownlint hint and improves rendering.

-```
+```text
 UnityMCPTests/
 ├── Assets/
ASYNC_QUEUE_UPDATE.md (1)

92-102: Add a language tag for the benchmark block

The markdown linter (MD040) is flagging the code block around the benchmark output because it lacks a language identifier. Please add one (e.g., ```text) so the docs pass lint.

Apply this diff:

-```
+```text
 🎯 25 Operations:
 ----------------------------------------
   individual      |   2847.3ms |   8.8 ops/s |  100.0% success
   queue_sync      |   1205.1ms |  20.7 ops/s |  100.0% success
   queue_async     |    982.7ms |  25.4 ops/s |  100.0% success
TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md (1)

100-107: Add a language tag for the directory layout block

markdownlint MD040 complains because this fenced block lacks a language hint. Adding something like ```text will satisfy the rule and keep the docs lint-clean.

Apply this diff:

-```
+```text
 Project1/.claude/claude-code.json → Port 6400
 Project2/.claude/claude-code.json → Port 6401
 Project3/.claude/claude-code.json → Port 6402
README-DEV.md (1)

52-58: Annotate the fenced block with a language.

markdownlint (MD040) flags this fenced block; consider adding a hint like ```text to keep our docs lint-clean.

UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs (1)

35-35: LGTM: Type inference refactoring

The changes from explicit Rect declarations to var are safe and align with the broader type inference refactoring pattern across the codebase. The type is clearly inferred from EditorGUILayout.GetControlRect() return values.

Also applies to: 50-50

UnityMcpBridge/Editor/Tools/ExecuteMenuItem.cs (1)

30-30: LGTM: Type inference refactoring

The changes from explicit type declarations (string, bool) to var are safe refactorings that align with the broader pattern in this PR. The compiler correctly infers:

  • Line 30: string from ToString()
  • Line 70: string from ToString() with null-coalescing
  • Line 103: bool from EditorApplication.ExecuteMenuItem()

Also applies to: 70-70, 103-103

UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs (1)

12-12: LGTM: Type inference refactoring

The changes to use var for type inference are safe and consistent with the broader refactoring pattern. The compiler correctly infers:

  • Lines 12, 34: bool from equality comparison
  • Line 35: JObject from ternary returning EnsureObject() results
  • Line 36: JObject from null-coalescing with cast
  • Line 55: string from assignment

Also applies to: 34-36, 55-55

CLAUDE.md (2)

9-10: Optional: Use markdown link syntax for URLs

The bare URLs work but could use markdown link syntax for better formatting:

-**Repository**: https://github.com/CoplayDev/unity-mcp (maintained by Coplay)
-**Discord**: https://discord.gg/y4p8KfzrN4
+**Repository**: [https://github.com/CoplayDev/unity-mcp](https://github.com/CoplayDev/unity-mcp) (maintained by Coplay)
+**Discord**: [https://discord.gg/y4p8KfzrN4](https://discord.gg/y4p8KfzrN4)

184-188: Optional: Add language identifier to fenced code block

The code block at line 184 is missing a language identifier. Add it for proper syntax highlighting:

-```
+```text
 MCP Client → Python Tool (@mcp.tool) → send_command_with_retry("tool_name") 
     → Unity Bridge (switch on "tool_name") → C# Handler (HandleCommand) 
     → Response back through chain

</blockquote></details>
<details>
<summary>tools/benchmark_operation_queue.py (1)</summary><blockquote>

`95-104`: **Log cleanup failures instead of swallowing them**

The bare `except` drops *all* exceptions, masking real issues (e.g., transport errors or permission problems) during cleanup. Please catch `Exception` explicitly and surface the message so failed deletions are visible.



Apply this diff to surface the failure without crashing:

```diff
-                except:
-                    pass  # Ignore errors for scripts that don't exist
+                except Exception as cleanup_error:
+                    print(f"⚠️ Could not delete {script_name}: {cleanup_error}")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between edd7817 and da74827.

📒 Files selected for processing (76)
  • .github/workflows/publish-upm.yml (1 hunks)
  • .gitignore (0 hunks)
  • .serena/.gitignore (1 hunks)
  • .serena/memories/code_style_conventions.md (1 hunks)
  • .serena/memories/project_overview.md (1 hunks)
  • .serena/memories/suggested_commands.md (1 hunks)
  • .serena/memories/task_completion_checklist.md (1 hunks)
  • .serena/project.yml (1 hunks)
  • ASYNC_QUEUE_UPDATE.md (1 hunks)
  • CLAUDE.md (1 hunks)
  • LICENSE (1 hunks)
  • OPERATION_QUEUE_REVIEW.md (1 hunks)
  • QUICK_WINS_ROADMAP.md (1 hunks)
  • README-DEV.md (1 hunks)
  • README.md (4 hunks)
  • STUDIO_FEATURES.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/.gitignore (1 hunks)
  • TestProjects/UnityMCPTests/.serena/memories/code_style_conventions.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/memories/project_overview.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/memories/suggested_commands.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/memories/task_completion_checklist.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/memories/unity_bridge_port_management.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_setup.md (1 hunks)
  • TestProjects/UnityMCPTests/.serena/project.yml (1 hunks)
  • TestProjects/UnityMCPTests/Assets/Scripts/Hello.cs (1 hunks)
  • TestProjects/UnityMCPTests/Assets/Scripts/LongUnityScriptClaudeTest.cs (13 hunks)
  • TestProjects/UnityMCPTests/Assets/Scripts/TestAsmdef.meta (1 hunks)
  • TestProjects/UnityMCPTests/Assets/Scripts/TestAsmdef/CustomComponent.cs (1 hunks)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/AIPropertyMatchingTests.cs (6 hunks)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/CommandRegistryTests.cs (0 hunks)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ComponentResolverTests.cs (10 hunks)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageGameObjectTests.cs (16 hunks)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageScriptValidationTests.cs (6 hunks)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/ManualConfigJsonBuilderTests.cs (4 hunks)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/WriteToConfigTests.cs (12 hunks)
  • TestProjects/UnityMCPTests/PORT_CONFIGURATION.md (1 hunks)
  • TestProjects/UnityMCPTests/Packages/manifest.json (1 hunks)
  • TestProjects/UnityMCPTests/ProjectSettings/ProjectVersion.txt (1 hunks)
  • UnityMcpBridge/Editor/Data/McpClients.cs (0 hunks)
  • UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs (3 hunks)
  • UnityMcpBridge/Editor/Helpers/ExecPath.cs (6 hunks)
  • UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs (13 hunks)
  • UnityMcpBridge/Editor/Helpers/OperationQueue.cs (1 hunks)
  • UnityMcpBridge/Editor/Helpers/OperationQueue.cs.meta (1 hunks)
  • UnityMcpBridge/Editor/Helpers/PackageDetector.cs (2 hunks)
  • UnityMcpBridge/Editor/Helpers/PackageInstaller.cs (3 hunks)
  • UnityMcpBridge/Editor/Helpers/PortManager.cs (9 hunks)
  • UnityMcpBridge/Editor/Helpers/Response.cs (3 hunks)
  • UnityMcpBridge/Editor/Helpers/ServerInstaller.cs (26 hunks)
  • UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs (4 hunks)
  • UnityMcpBridge/Editor/MCPForUnity.Editor.asmdef (2 hunks)
  • UnityMcpBridge/Editor/MCPForUnityBridge.cs (28 hunks)
  • UnityMcpBridge/Editor/Tools/ExecuteMenuItem.cs (3 hunks)
  • UnityMcpBridge/Editor/Tools/ManageAsset.cs (43 hunks)
  • UnityMcpBridge/Editor/Tools/ManageEditor.cs (17 hunks)
  • UnityMcpBridge/Editor/Tools/ManageGameObject.cs (78 hunks)
  • UnityMcpBridge/Editor/Tools/ManageQueue.cs (1 hunks)
  • UnityMcpBridge/Editor/Tools/ManageQueue.cs.meta (1 hunks)
  • UnityMcpBridge/Editor/Tools/ManageScene.cs (10 hunks)
  • UnityMcpBridge/Editor/Tools/ManageScript.cs (70 hunks)
  • UnityMcpBridge/Editor/Tools/ManageShader.cs (7 hunks)
  • UnityMcpBridge/Editor/Tools/ReadConsole.cs (12 hunks)
  • UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs (80 hunks)
  • UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs (2 hunks)
  • UnityMcpBridge/Editor/Windows/VSCodeManualSetupWindow.cs (6 hunks)
  • UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs (12 hunks)
  • UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py (2 hunks)
  • UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py (1 hunks)
  • UnityMcpBridge/package.json (2 hunks)
  • deploy-dev.bat (1 hunks)
  • mcp_source.py (1 hunks)
  • restore-dev.bat (1 hunks)
  • tests/test_operation_queue.py (1 hunks)
  • tools/benchmark_operation_queue.py (1 hunks)
  • tools/test_async_queue.py (1 hunks)
💤 Files with no reviewable changes (3)
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/CommandRegistryTests.cs
  • UnityMcpBridge/Editor/Data/McpClients.cs
  • .gitignore
🧰 Additional context used
🧠 Learnings (9)
📚 Learning: 2025-09-04T01:01:11.927Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 260
File: UnityMcpBridge/UnityMcpServer~/src/server_version.txt:1-1
Timestamp: 2025-09-04T01:01:11.927Z
Learning: The UnityMcpBridge project is not maintaining changelogs yet, so don't suggest adding changelog entries for version bumps.

Applied to files:

  • TestProjects/UnityMCPTests/PORT_CONFIGURATION.md
  • TestProjects/UnityMCPTests/.serena/memories/task_completion_checklist.md
  • UnityMcpBridge/Editor/Helpers/PackageInstaller.cs
  • .serena/memories/project_overview.md
  • UnityMcpBridge/Editor/Helpers/OperationQueue.cs.meta
  • UnityMcpBridge/Editor/Windows/VSCodeManualSetupWindow.cs
  • CLAUDE.md
  • UnityMcpBridge/Editor/Tools/ManageQueue.cs.meta
  • TestProjects/UnityMCPTests/.serena/memories/code_style_conventions.md
  • UnityMcpBridge/package.json
  • README-DEV.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_setup.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_bridge_port_management.md
  • UnityMcpBridge/Editor/Tools/ReadConsole.cs
  • .serena/memories/suggested_commands.md
  • .serena/memories/code_style_conventions.md
  • README.md
  • TestProjects/UnityMCPTests/.serena/memories/suggested_commands.md
  • TestProjects/UnityMCPTests/.serena/memories/project_overview.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md
  • TestProjects/UnityMCPTests/ProjectSettings/ProjectVersion.txt
  • UnityMcpBridge/Editor/Helpers/PackageDetector.cs
  • UnityMcpBridge/Editor/MCPForUnity.Editor.asmdef
  • UnityMcpBridge/Editor/MCPForUnityBridge.cs
  • TestProjects/UnityMCPTests/Packages/manifest.json
📚 Learning: 2025-10-13T13:27:23.040Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 316
File: TestProjects/UnityMCPTests/Assets/Tests/EditMode/Resources.meta:1-8
Timestamp: 2025-10-13T13:27:23.040Z
Learning: UnityMcpBridge is a legacy project kept for backwards compatibility; MCPForUnity is the only active Unity plugin project. GUID collisions between UnityMcpBridge and MCPForUnity are acceptable.

Applied to files:

  • TestProjects/UnityMCPTests/PORT_CONFIGURATION.md
  • TestProjects/UnityMCPTests/.serena/memories/task_completion_checklist.md
  • UnityMcpBridge/Editor/Helpers/PackageInstaller.cs
  • .serena/memories/project_overview.md
  • UnityMcpBridge/Editor/Helpers/OperationQueue.cs.meta
  • UnityMcpBridge/Editor/Windows/VSCodeManualSetupWindow.cs
  • UnityMcpBridge/Editor/Tools/ManageQueue.cs.meta
  • TestProjects/UnityMCPTests/.serena/memories/code_style_conventions.md
  • UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs
  • UnityMcpBridge/package.json
  • README-DEV.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_setup.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_bridge_port_management.md
  • .serena/memories/suggested_commands.md
  • .serena/memories/code_style_conventions.md
  • README.md
  • UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs
  • UnityMcpBridge/Editor/Tools/ManageQueue.cs
  • UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs
  • TestProjects/UnityMCPTests/.serena/memories/project_overview.md
  • UnityMcpBridge/Editor/Tools/ManageGameObject.cs
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md
  • TestProjects/UnityMCPTests/ProjectSettings/ProjectVersion.txt
  • mcp_source.py
  • UnityMcpBridge/Editor/Helpers/PackageDetector.cs
  • UnityMcpBridge/Editor/MCPForUnity.Editor.asmdef
  • UnityMcpBridge/Editor/MCPForUnityBridge.cs
  • UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs
  • TestProjects/UnityMCPTests/Packages/manifest.json
  • UnityMcpBridge/Editor/Tools/ManageEditor.cs
  • UnityMcpBridge/Editor/Tools/ManageAsset.cs
  • UnityMcpBridge/Editor/Tools/ManageScript.cs
  • UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs
  • UnityMcpBridge/Editor/Tools/ManageShader.cs
📚 Learning: 2025-10-13T13:41:00.086Z
Learnt from: JohanHoltby
Repo: CoplayDev/unity-mcp PR: 309
File: MCPForUnity/Editor/Helpers/ServerInstaller.cs:478-508
Timestamp: 2025-10-13T13:41:00.086Z
Learning: In the MCPForUnityTools feature (MCPForUnity/Editor/Helpers/ServerInstaller.cs), the design intentionally forces users to have only one .py file per MCPForUnityTools folder to keep file tracking simple. Package-style tools (subdirectories with __init__.py) are not supported.

Applied to files:

  • UnityMcpBridge/Editor/Helpers/PackageInstaller.cs
  • .serena/memories/project_overview.md
  • CLAUDE.md
  • TestProjects/UnityMCPTests/.serena/memories/code_style_conventions.md
  • STUDIO_FEATURES.md
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/WriteToConfigTests.cs
  • UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs
  • README-DEV.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_setup.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_bridge_port_management.md
  • .serena/memories/suggested_commands.md
  • .serena/memories/code_style_conventions.md
  • README.md
  • TestProjects/UnityMCPTests/.serena/memories/suggested_commands.md
  • TestProjects/UnityMCPTests/.serena/memories/project_overview.md
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md
  • UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py
  • mcp_source.py
  • UnityMcpBridge/Editor/Helpers/PackageDetector.cs
  • UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs
  • UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py
  • UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs
📚 Learning: 2025-10-03T22:11:46.002Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 301
File: docs/CUSTOM_TOOLS.md:54-62
Timestamp: 2025-10-03T22:11:46.002Z
Learning: In Unity MCP, the `description` parameter in the `mcp_for_unity_tool` decorator is technically optional but should always be included as a best practice. Without it, there's a higher chance that MCP clients will not parse the tool correctly. All Unity MCP tools should include the description in the decorator for compatibility.

Applied to files:

  • .serena/memories/project_overview.md
  • CLAUDE.md
  • TestProjects/UnityMCPTests/.serena/memories/code_style_conventions.md
  • UnityMcpBridge/package.json
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_setup.md
  • README.md
  • UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py
📚 Learning: 2025-11-05T18:23:12.319Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 368
File: MCPForUnity/UnityMcpServer~/src/resources/menu_items.py:15-15
Timestamp: 2025-11-05T18:23:12.319Z
Learning: In Unity MCP, the `name` parameter in the `mcp_for_unity_resource` decorator is the external API name exposed to MCP clients (LLMs, AI agents). The command string passed to `async_send_command_with_retry` or `async_send_with_unity_instance` (e.g., "get_menu_items") is the internal command identifier that must match the C# side. These are decoupled, allowing external API naming to evolve independently of internal command routing.

Applied to files:

  • .serena/memories/project_overview.md
  • UnityMcpBridge/package.json
  • UnityMcpBridge/Editor/Tools/ManageQueue.cs
  • TestProjects/UnityMCPTests/.serena/memories/project_overview.md
  • UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py
  • mcp_source.py
  • UnityMcpBridge/Editor/MCPForUnityBridge.cs
  • UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py
📚 Learning: 2025-09-03T16:00:55.839Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 0
File: :0-0
Timestamp: 2025-09-03T16:00:55.839Z
Learning: ComponentResolver in UnityMcpBridge/Editor/Tools/ManageGameObject.cs is a nested static class within ManageGameObject, not a sibling type. The `using static MCPForUnity.Editor.Tools.ManageGameObject;` import is required to access ComponentResolver methods directly without the outer class qualifier.

Applied to files:

  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/AIPropertyMatchingTests.cs
  • UnityMcpBridge/Editor/Windows/VSCodeManualSetupWindow.cs
  • UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ComponentResolverTests.cs
  • UnityMcpBridge/Editor/Tools/ReadConsole.cs
  • UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageGameObjectTests.cs
  • UnityMcpBridge/Editor/Tools/ManageQueue.cs
  • UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs
  • UnityMcpBridge/Editor/Tools/ManageScene.cs
  • UnityMcpBridge/Editor/Tools/ManageGameObject.cs
  • UnityMcpBridge/Editor/Helpers/Response.cs
  • UnityMcpBridge/Editor/Tools/ManageEditor.cs
  • UnityMcpBridge/Editor/Tools/ManageAsset.cs
  • UnityMcpBridge/Editor/Tools/ManageScript.cs
  • UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs
  • UnityMcpBridge/Editor/Tools/ManageShader.cs
📚 Learning: 2025-10-24T14:09:08.615Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 348
File: MCPForUnity/Editor/Helpers/ConfigJsonBuilder.cs:71-79
Timestamp: 2025-10-24T14:09:08.615Z
Learning: The SystemRoot environment variable on Windows is only required for Codex MCP client configurations due to a Codex bug. Other MCP clients (VSCode, Cursor, Windsurf, Kiro) do not need this environment variable. Codex configurations use TOML format (CodexConfigHelper.cs), while other clients use JSON format (ConfigJsonBuilder.cs).

Applied to files:

  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/WriteToConfigTests.cs
  • UnityMcpBridge/Editor/Helpers/PackageDetector.cs
  • UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs
📚 Learning: 2025-09-05T16:22:04.960Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 265
File: README.md:204-204
Timestamp: 2025-09-05T16:22:04.960Z
Learning: In the Unity MCP project, the ServerInstaller.cs creates a symlink from ~/Library/AppSupport to ~/Library/Application Support on macOS to mitigate argument parsing and quoting issues in some MCP clients. The README documentation should use the shortened AppSupport path, not the full "Application Support" path with spaces.

Applied to files:

  • UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs
  • UnityMcpBridge/package.json
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_setup.md
  • .serena/memories/suggested_commands.md
  • README.md
  • TestProjects/UnityMCPTests/.serena/memories/suggested_commands.md
  • UnityMcpBridge/Editor/Helpers/ServerInstaller.cs
  • UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md
  • UnityMcpBridge/Editor/Helpers/PackageDetector.cs
  • UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs
📚 Learning: 2025-09-05T16:22:04.960Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 265
File: README.md:204-204
Timestamp: 2025-09-05T16:22:04.960Z
Learning: In the Unity MCP project, the ServerInstaller.cs creates a symlink from ~/Library/AppSupport to ~/Library/Application Support on macOS to avoid spaces in paths that can cause arg parsing and quoting issues in some MCP clients. The README documentation should use the shortened AppSupport path, not the full "Application Support" path.

Applied to files:

  • UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs
  • UnityMcpBridge/package.json
  • UnityMcpBridge/Editor/Helpers/ServerInstaller.cs
  • UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs
  • TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md
  • UnityMcpBridge/Editor/Helpers/PackageDetector.cs
  • UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs
🧬 Code graph analysis (27)
UnityMcpBridge/Editor/Helpers/PackageInstaller.cs (1)
UnityMcpBridge/Editor/Helpers/ServerInstaller.cs (2)
  • ServerInstaller (12-738)
  • EnsureServerInstalled (22-110)
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/ManualConfigJsonBuilderTests.cs (1)
UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs (2)
  • ConfigJsonBuilder (7-128)
  • BuildManualConfigJson (9-29)
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/WriteToConfigTests.cs (2)
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/ManualConfigJsonBuilderTests.cs (3)
  • Test (10-24)
  • Test (26-38)
  • Test (40-52)
UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs (2)
  • JObject (31-41)
  • JObject (121-127)
tools/test_async_queue.py (2)
UnityMcpBridge/UnityMcpServer~/src/unity_connection.py (1)
  • send_command_with_retry (388-407)
tools/benchmark_operation_queue.py (1)
  • main (352-400)
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ComponentResolverTests.cs (1)
UnityMcpBridge/Editor/Tools/ManageGameObject.cs (2)
  • ComponentResolver (2197-2457)
  • TryResolve (2207-2243)
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageScriptValidationTests.cs (1)
UnityMcpBridge/Editor/Tools/ManageScript.cs (1)
  • ManageScript (51-2560)
tests/test_operation_queue.py (1)
UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py (3)
  • manage_queue (37-131)
  • register_manage_queue (13-227)
  • queue_batch_operations (144-227)
UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs (1)
UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs (1)
  • UnityEngineObjectConverter (165-266)
UnityMcpBridge/Editor/Helpers/PortManager.cs (1)
UnityMcpBridge/Editor/MCPForUnityBridge.cs (5)
  • System (568-613)
  • System (615-619)
  • System (621-640)
  • System (642-659)
  • ComputeProjectHash (1000-1018)
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageGameObjectTests.cs (1)
UnityMcpBridge/Editor/Tools/ManageGameObject.cs (10)
  • GameObject (1191-1214)
  • ManageGameObject (21-2191)
  • HandleCommand (40-173)
  • ComponentResolver (2197-2457)
  • TryResolve (2207-2243)
  • List (1219-1378)
  • List (2258-2295)
  • List (2318-2336)
  • List (2341-2380)
  • List (2388-2423)
UnityMcpBridge/Editor/Tools/ManageQueue.cs (2)
UnityMcpBridge/Editor/Helpers/Response.cs (4)
  • Response (12-190)
  • EnhancedError (76-114)
  • Success (20-35)
  • Error (43-62)
UnityMcpBridge/Editor/Helpers/OperationQueue.cs (10)
  • AddOperation (66-97)
  • ExecuteBatch (259-270)
  • ClearQueue (354-374)
  • GetQueueStats (379-398)
  • RemoveOperation (403-410)
  • CancelOperation (415-430)
  • OperationQueue (25-431)
  • QueuedOperation (30-42)
  • Task (124-253)
  • Task (275-290)
UnityMcpBridge/Editor/Helpers/ServerInstaller.cs (1)
UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs (1)
  • FindUvPath (2046-2049)
UnityMcpBridge/Editor/Tools/ManageScene.cs (1)
UnityMcpBridge/Editor/Helpers/Response.cs (3)
  • Response (12-190)
  • Success (20-35)
  • Error (43-62)
UnityMcpBridge/Editor/Tools/ManageGameObject.cs (4)
UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs (5)
  • Vector2Converter (37-57)
  • UnityEngineObjectConverter (165-266)
  • Color (103-112)
  • Vector2 (49-56)
  • UnityEngine (223-265)
UnityMcpBridge/Editor/Helpers/Response.cs (2)
  • Response (12-190)
  • Error (43-62)
UnityMcpBridge/Editor/Tools/ManageScript.cs (1)
  • System (2291-2357)
UnityMcpBridge/Editor/Tools/ManageAsset.cs (1)
  • ConvertJTokenToType (1166-1243)
UnityMcpBridge/Editor/Helpers/Response.cs (3)
UnityMcpBridge/Editor/Tools/ManageScript.cs (1)
  • System (2291-2357)
UnityMcpBridge/Editor/Tools/ManageGameObject.cs (6)
  • UnityEngine (2072-2169)
  • List (1219-1378)
  • List (2258-2295)
  • List (2318-2336)
  • List (2341-2380)
  • List (2388-2423)
UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs (1)
  • UnityEngine (223-265)
UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py (1)
UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py (2)
  • manage_queue (37-131)
  • register_manage_queue (13-227)
UnityMcpBridge/Editor/Helpers/PackageDetector.cs (1)
UnityMcpBridge/Editor/Helpers/ServerInstaller.cs (2)
  • ServerInstaller (12-738)
  • GetServerPath (112-115)
UnityMcpBridge/Editor/MCPForUnityBridge.cs (3)
UnityMcpBridge/Editor/Models/Command.cs (1)
  • Command (8-19)
UnityMcpBridge/Editor/Tools/ManageQueue.cs (2)
  • ManageQueue (17-510)
  • HandleCommand (22-83)
UnityMcpBridge/Editor/Helpers/ServerInstaller.cs (2)
  • ServerInstaller (12-738)
  • GetServerPath (112-115)
tools/benchmark_operation_queue.py (2)
UnityMcpBridge/UnityMcpServer~/src/unity_connection.py (1)
  • send_command_with_retry (388-407)
tools/test_async_queue.py (1)
  • main (228-280)
UnityMcpBridge/Editor/Windows/MCPForUnityEditorWindow.cs (7)
UnityMcpBridge/Editor/MCPForUnityBridge.cs (5)
  • MCPForUnityBridge (104-125)
  • IsAutoConnectMode (62-62)
  • GetCurrentPort (61-61)
  • Stop (356-414)
  • Start (237-354)
UnityMcpBridge/Editor/Helpers/ServerInstaller.cs (3)
  • ServerInstaller (12-738)
  • GetServerPath (112-115)
  • FindUvPath (524-712)
UnityMcpBridge/Editor/Helpers/ExecPath.cs (2)
  • ExecPath (10-276)
  • ResolveClaude (15-88)
UnityMcpBridge/Editor/Helpers/ConfigJsonBuilder.cs (2)
  • ConfigJsonBuilder (7-128)
  • BuildManualConfigJson (9-29)
UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs (2)
  • ManualConfigEditorWindow (9-288)
  • ShowWindow (19-27)
UnityMcpBridge/Editor/Helpers/ServerPathResolver.cs (2)
  • ServerPathResolver (7-147)
  • TryFindEmbeddedServerSource (14-99)
UnityMcpBridge/Editor/Helpers/McpLog.cs (2)
  • McpLog (6-30)
  • Info (15-19)
UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py (2)
UnityMcpBridge/UnityMcpServer~/src/unity_connection.py (1)
  • send_command_with_retry (388-407)
UnityMcpBridge/Editor/Helpers/OperationQueue.cs (1)
  • List (334-347)
UnityMcpBridge/Editor/Tools/ManageEditor.cs (1)
UnityMcpBridge/Editor/Helpers/Response.cs (2)
  • Response (12-190)
  • Error (43-62)
UnityMcpBridge/Editor/Tools/ManageAsset.cs (2)
UnityMcpBridge/Editor/Helpers/Response.cs (3)
  • Response (12-190)
  • Error (43-62)
  • Success (20-35)
UnityMcpBridge/Editor/Tools/ManageGameObject.cs (9)
  • ComponentResolver (2197-2457)
  • TryResolve (2207-2243)
  • GameObject (1191-1214)
  • List (1219-1378)
  • List (2258-2295)
  • List (2318-2336)
  • List (2341-2380)
  • List (2388-2423)
  • Type (2176-2190)
UnityMcpBridge/Editor/Tools/ManageScript.cs (1)
UnityMcpBridge/Editor/Helpers/Response.cs (5)
  • Response (12-190)
  • EnhancedError (76-114)
  • Success (20-35)
  • ScriptError (139-150)
  • Error (43-62)
UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs (2)
UnityMcpBridge/Editor/Tools/ManageGameObject.cs (2)
  • Vector3 (1168-1186)
  • Vector3 (1975-1990)
UnityMcpBridge/Editor/Helpers/Vector3Helper.cs (1)
  • Vector3 (17-22)
UnityMcpBridge/Editor/Tools/ManageShader.cs (1)
UnityMcpBridge/Editor/Tools/ManageAsset.cs (1)
  • DeleteAsset (493-521)
UnityMcpBridge/Editor/Helpers/OperationQueue.cs (2)
UnityMcpBridge/Editor/Helpers/Response.cs (3)
  • Error (43-62)
  • Response (12-190)
  • Success (20-35)
UnityMcpBridge/Editor/Tools/ManageQueue.cs (8)
  • AddOperation (88-142)
  • ExecuteBatchAsync (168-187)
  • ExecuteBatch (147-163)
  • HandleCommand (22-83)
  • ClearQueue (401-429)
  • GetQueueStats (434-451)
  • RemoveOperation (456-509)
  • CancelOperation (293-345)
🪛 LanguageTool
TestProjects/UnityMCPTests/.serena/memories/code_style_conventions.md

[style] ~30-~30: ‘with success’ might be wordy. Consider a shorter alternative.
Context: ...ocks - Return structured JSON responses with success/error fields - Log detailed errors to U...

(EN_WORDINESS_PREMIUM_WITH_SUCCESS)

🪛 markdownlint-cli2 (0.18.1)
CLAUDE.md

9-9: Bare URL used

(MD034, no-bare-urls)


10-10: Bare URL used

(MD034, no-bare-urls)


184-184: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

README-DEV.md

56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

TestProjects/UnityMCPTests/.serena/memories/unity_bridge_port_management.md

35-35: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

ASYNC_QUEUE_UPDATE.md

92-92: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

README.md

10-10: Bare URL used

(MD034, no-bare-urls)


334-334: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


335-335: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


336-336: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


337-337: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

TestProjects/UnityMCPTests/.serena/memories/project_overview.md

10-10: Bare URL used

(MD034, no-bare-urls)


27-27: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

TestProjects/UnityMCPTests/.serena/memories/unity_mcp_local_setup.md

100-100: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 Ruff (0.14.3)
tools/test_async_queue.py

1-1: Shebang is present but file is not executable

(EXE001)


98-98: Unused function argument: operation_ids

(ARG001)


118-118: Unused function argument: operation_ids

(ARG001)


200-200: f-string without any placeholders

Remove extraneous f prefix

(F541)


204-204: String contains ambiguous (INFORMATION SOURCE). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


223-223: Do not use bare except

(E722)


223-224: try-except-pass detected, consider logging the exception

(S110)


271-271: Consider moving this statement to an else block

(TRY300)


276-276: Do not catch blind exception: Exception

(BLE001)

tests/test_operation_queue.py

238-238: Consider [*add_responses, execute_response] instead of concatenation

Replace with [*add_responses, execute_response]

(RUF005)

tools/benchmark_operation_queue.py

1-1: Shebang is present but file is not executable

(EXE001)


92-92: Local variable response is assigned to but never used

Remove assignment to unused variable response

(F841)


103-103: Do not use bare except

(E722)


103-104: try-except-pass detected, consider logging the exception

(S110)


107-107: Do not catch blind exception: Exception

(BLE001)


126-126: Do not catch blind exception: Exception

(BLE001)


242-242: f-string without any placeholders

Remove extraneous f prefix

(F541)


286-286: Do not catch blind exception: Exception

(BLE001)


346-346: f-string without any placeholders

Remove extraneous f prefix

(F541)


395-395: Do not catch blind exception: Exception

(BLE001)

UnityMcpBridge/UnityMcpServer~/src/tools/manage_queue.py

38-38: Unused function argument: ctx

(ARG001)


125-125: Do not catch blind exception: Exception

(BLE001)


126-126: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


126-126: Use explicit conversion flag

Replace with conversion flag

(RUF010)


129-129: Use explicit conversion flag

Replace with conversion flag

(RUF010)


221-221: Do not catch blind exception: Exception

(BLE001)


222-222: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


222-222: Use explicit conversion flag

Replace with conversion flag

(RUF010)


225-225: Use explicit conversion flag

Replace with conversion flag

(RUF010)

🔇 Additional comments (38)
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/WriteToConfigTests.cs (4)

1-239: PR objectives don't match file content.

The PR title and objectives describe fixing a jq parse error in Discord notification logic, but this file contains C# test code with field naming refactors. No Discord notification or jq-related code is present in this file.

Please verify that the correct file was included in this PR, or update the PR description to accurately reflect the changes.


17-19: Field naming refactor applied consistently.

The field naming convention change from underscore-prefix (_tempRoot) to explicit this. qualifier (this.tempRoot) is applied consistently throughout the file. Both conventions are valid in C#; the refactor maintains readability and consistency.


142-147: Consistent trailing comma formatting.

Adding trailing commas in object and array initializers improves future diff readability when properties/elements are added. The formatting is applied consistently.

Also applies to: 174-174, 196-198, 210-212


230-234: Improved reflection call readability.

The formatted layout with inline parameter name comments makes the reflection invocation easier to understand and maintain, especially valuable when parameter names aren't visible through IDE hints.

TestProjects/UnityMCPTests/.serena/.gitignore (1)

1-1: LGTM!

Standard gitignore pattern for excluding cache directories from version control in the test project.

.serena/.gitignore (1)

1-1: LGTM!

Consistent cache exclusion pattern at the root level.

UnityMcpBridge/Editor/MCPForUnity.Editor.asmdef (1)

6-6: LGTM!

Clean formatting improvements: removed trailing whitespace and added newline at end of file. No functional changes to the assembly definition.

Also applies to: 19-19

TestProjects/UnityMCPTests/Assets/Scripts/Hello.cs (1)

1-12: LGTM!

Good cleanup removing the unused System.Collections import and minor formatting improvements.

mcp_source.py (1)

26-26: LGTM!

Package name rebrand from Coplay to The One Game Studio fork. The upstream URL at line 95 correctly remains pointing to CoplayDev/unity-mcp as the original repository, which is appropriate for a fork that tracks upstream changes.

restore-dev.bat (1)

22-22: LGTM!

Example path updated to reflect the rebranded package name, consistent with the fork changes.

UnityMcpBridge/Editor/Helpers/PackageInstaller.cs (1)

13-13: LGTM!

Pure whitespace formatting improvements with no functional changes.

Also applies to: 23-23, 30-30, 33-33, 43-43

deploy-dev.bat (1)

22-22: LGTM!

Example path updated consistently with the package rebrand.

UnityMcpBridge/Editor/Helpers/OperationQueue.cs.meta (1)

1-2: LGTM!

Standard Unity meta file for the new OperationQueue.cs. GUID appears unique.

TestProjects/UnityMCPTests/ProjectSettings/ProjectVersion.txt (1)

1-2: Verify compatibility with Unity 6 upgrade.

This is a major Unity version upgrade from 2021.3 LTS to Unity 6 (6000.2.5f1). Ensure all existing code, packages, and tests remain compatible, as Unity 6 introduced API changes and deprecations.

UnityMcpBridge/Editor/Windows/VSCodeManualSetupWindow.cs (1)

33-48: LGTM!

Type inference refactors (Rect → var) improve consistency without changing functionality.

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/AIPropertyMatchingTests.cs (1)

1-168: LGTM!

Removed unused using directives and cleaned up whitespace. No functional changes to test logic.

LICENSE (1)

3-4: LGTM!

Proper fork attribution maintaining original copyright while adding fork modifications copyright. This is correct practice under the MIT license.

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Windows/ManualConfigJsonBuilderTests.cs (1)

14-44: LGTM!

Type inference refactors (string → var) improve code consistency without affecting test behavior.

UnityMcpBridge/Editor/Helpers/PackageDetector.cs (1)

19-24: LGTM!

Type inference refactors improve consistency. Logic unchanged.

TestProjects/UnityMCPTests/.serena/memories/unity_mcp_setup.md (1)

1-80: LGTM! Helpful setup documentation.

This setup guide provides clear instructions for configuring Unity MCP Bridge, including auto-setup, manual configuration, available tools, verification steps, and troubleshooting. The content is well-organized and useful for developers working with Unity MCP.

.serena/memories/task_completion_checklist.md (1)

1-28: LGTM!

The checklist provides comprehensive, well-organized guidance for task completion covering Python, C#, and cross-cutting concerns appropriate for this Unity MCP project.

TestProjects/UnityMCPTests/.serena/memories/task_completion_checklist.md (1)

1-81: LGTM!

This comprehensive project-specific checklist provides thorough coverage of validation, testing, code quality, and integration concerns appropriate for the Unity MCP test project.

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageGameObjectTests.cs (2)

75-75: LGTM!

The refactoring to use out var for type inference in ComponentResolver.TryResolve calls is idiomatic C# and improves readability while maintaining type safety.

Also applies to: 96-96


199-288: LGTM!

The test correctly verifies the collect-and-continue error handling behavior, ensuring valid properties are applied despite invalid ones, and confirms that error details are properly structured in the response.

.serena/memories/suggested_commands.md (1)

1-53: LGTM!

The development commands reference provides clear, organized guidance for testing, deployment, environment setup, and version management appropriate for the forked Unity MCP project.

UnityMcpBridge/Runtime/Serialization/UnityTypeConverters.cs (2)

26-34: LGTM!

The refactoring to use var for local variables in JSON converter ReadJson methods is idiomatic C# and maintains type safety through inference without changing serialization behavior.

Also applies to: 49-56, 75-84, 103-112, 131-140, 155-161


223-265: LGTM!

The use of var for local variables in the UnityEngine.Object converter's ReadJson method improves consistency while preserving the conditional deserialization logic for Editor and Runtime contexts.

.serena/project.yml (1)

1-68: LGTM!

The Serena project configuration is properly structured with appropriate settings for a C# Unity project, including language specification, gitignore integration, and comprehensive tool definitions.

.serena/memories/project_overview.md (1)

1-22: LGTM!

The project overview provides a clear, accurate description of the MCP for Unity architecture, tech stack, and key components that aligns with the codebase structure.

UnityMcpBridge/Editor/Tools/ManageScene.cs (1)

24-62: Path normalization update looks solid.

The tightened sanitization plus sensible default directory makes the create/load flows more forgiving without altering existing behavior. Thanks for smoothing out those edge cases.

UnityMcpBridge/Editor/Helpers/PortManager.cs (1)

44-71: Stored-port guard still behaves correctly.

Verifying the project path before reusing a stored port keeps the fallback deterministic while avoiding stale configs—nice refinement.

.github/workflows/publish-upm.yml (1)

549-586: Switching to jq -n fixes the Discord payload bug.

Building the payload directly with jq -n and --arg/--argjson keeps everything JSON-safe and avoids the parse errors we saw with heredocs.

UnityMcpBridge/Editor/Tools/ManageQueue.cs.meta (1)

1-2: Meta file addition is consistent.

GUID registration looks good for the new editor tool.

TestProjects/UnityMCPTests/PORT_CONFIGURATION.md (1)

1-28: LGTM: Clear port configuration documentation

The documentation clearly explains the rationale for using port 6401 and provides step-by-step configuration guidance. The structure is well-organized and helpful for developers working with multiple Unity projects.

UnityMcpBridge/UnityMcpServer~/src/tools/__init__.py (1)

12-12: LGTM: Operation queue tool registration

The import and registration of register_manage_queue follows the established pattern for tool registration in this module. The "STUDIO:" comment prefix clearly identifies this as a studio-specific feature, consistent with the fork's conventions.

Also applies to: 29-30

CLAUDE.md (1)

1-434: Excellent comprehensive documentation

This CLAUDE.md file provides thorough guidance for AI assistants working with the Unity MCP codebase. It covers:

  • Project architecture and key components
  • Development commands and workflows
  • Communication protocol details
  • Tool implementation patterns
  • Testing procedures

The content is well-organized and will be valuable for both AI assistants and human developers.

STUDIO_FEATURES.md (1)

1-228: Excellent studio features documentation

This documentation provides clear planning, development guidelines, and usage examples for The One Game Studio's MCP extensions. The changelog accurately reflects the implemented features (enhanced error messages and operation queuing), and the usage guide provides practical examples for developers.

The structure effectively communicates:

  • Planned features with priorities
  • Development and testing guidelines
  • Integration with existing tools
  • Versioning strategy
  • Quick wins usage guide with examples
.serena/memories/code_style_conventions.md (1)

1-24: LGTM: Clear code style documentation

This documentation provides concise and practical coding conventions that align with the actual code patterns observed throughout the codebase. The conventions for C# (namespace, naming, error handling) and Python (PEP 8, type hints, async patterns) are well-defined, and the general principles promote good practices like input validation and cross-platform handling.

## Unity Editor Commands
```bash
# Open Unity project with specific version
/home/tuha/Unity/Hub/Editor/6000.2.5f1/Editor/Unity -projectpath /mnt/Work/1M/unity-mcp/TestProjects/UnityMCPTests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace hardcoded user-specific paths with placeholders.

Lines 6, 9, and 22 contain absolute paths specific to the user's environment (/home/tuha, /mnt/Work/1M/unity-mcp). Documentation should use generic placeholders or relative references so other developers can adapt the examples.

Apply this approach:

-/home/tuha/Unity/Hub/Editor/6000.2.5f1/Editor/Unity -projectpath /mnt/Work/1M/unity-mcp/TestProjects/UnityMCPTests
+/path/to/Unity/Hub/Editor/<VERSION>/Editor/Unity -projectpath /path/to/unity-mcp/TestProjects/UnityMCPTests

-unity-hub --project /mnt/Work/1M/unity-mcp/TestProjects/UnityMCPTests
+unity-hub --project /path/to/unity-mcp/TestProjects/UnityMCPTests

-cd /mnt/Work/1M/unity-mcp
+cd /path/to/unity-mcp

Also applies to: 9-9, 22-22

🤖 Prompt for AI Agents
In TestProjects/UnityMCPTests/.serena/memories/suggested_commands.md around
lines 6, 9 and 22, the file contains hardcoded, user-specific absolute paths
(/home/tuha, /mnt/Work/1M/unity-mcp); replace these with generic placeholders or
relative paths (for example {USER_HOME}, {UNITY_INSTALL_DIR}, {PROJECT_ROOT} or
./relative/path) so examples work for other developers, and update the three
occurrences accordingly while keeping the command structure intact.

Comment on lines +71 to +74
"tool": "read_console",
"parameters": {"action": "read"},
"timeout_ms": 5000
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use the supported read_console action name.

The queue adds a read_console operation with "action": "read", but ReadConsole.HandleCommand only accepts "get" or "clear". This third enqueue will always return an error, so the script exits early (return False) and the rest of the suite never runs. Please switch the action to "get" so the test can complete successfully.

-        {
-            "tool": "read_console",
-            "parameters": {"action": "read"},
+        {
+            "tool": "read_console",
+            "parameters": {"action": "get"},
             "timeout_ms": 5000
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"tool": "read_console",
"parameters": {"action": "read"},
"timeout_ms": 5000
}
"tool": "read_console",
"parameters": {"action": "get"},
"timeout_ms": 5000
}
🤖 Prompt for AI Agents
In tools/test_async_queue.py around lines 71 to 74, the queued operation uses
"action": "read" which is unsupported by ReadConsole.HandleCommand (it expects
"get" or "clear"), causing that enqueue to error and abort the test run; change
the action value from "read" to "get" so the read_console operation is accepted
and the test suite continues.

Comment on lines +275 to +289
private static async Task<object> ExecuteOperationWithTimeoutAsync(QueuedOperation operation)
{
var cancellationTokenSource = new CancellationTokenSource(operation.TimeoutMs);

try
{
// Execute on Unity's main thread with timeout
var task = Task.Run(() => ExecuteOperation(operation), cancellationTokenSource.Token);

return await task;
}
catch (OperationCanceledException)
{
throw new TimeoutException($"Operation {operation.Id} timed out after {operation.TimeoutMs}ms");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Timeout never fires for async operations

Task.Run only honours the cancellation token before the delegate starts, so the CancelAfter signal is ignored once ExecuteOperation(operation) is running. As a result, long-running tools never trip the timeout and the queue keeps waiting forever. Please enforce the timeout with Task.WhenAny (or similar) so we actually break out when TimeoutMs is exceeded.

Apply this diff to fix the timeout handling:

         private static async Task<object> ExecuteOperationWithTimeoutAsync(QueuedOperation operation)
         {
-            var cancellationTokenSource = new CancellationTokenSource(operation.TimeoutMs);
-
-            try
-            {
-                // Execute on Unity's main thread with timeout
-                var task = Task.Run(() => ExecuteOperation(operation), cancellationTokenSource.Token);
-
-                return await task;
-            }
-            catch (OperationCanceledException)
-            {
-                throw new TimeoutException($"Operation {operation.Id} timed out after {operation.TimeoutMs}ms");
-            }
+            var executeTask = Task.Run(() => ExecuteOperation(operation));
+            var timeoutTask = Task.Delay(operation.TimeoutMs);
+
+            var completedTask = await Task.WhenAny(executeTask, timeoutTask).ConfigureAwait(false);
+
+            if (completedTask != executeTask)
+            {
+                throw new TimeoutException($"Operation {operation.Id} timed out after {operation.TimeoutMs}ms");
+            }
+
+            return await executeTask.ConfigureAwait(false);
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private static async Task<object> ExecuteOperationWithTimeoutAsync(QueuedOperation operation)
{
var cancellationTokenSource = new CancellationTokenSource(operation.TimeoutMs);
try
{
// Execute on Unity's main thread with timeout
var task = Task.Run(() => ExecuteOperation(operation), cancellationTokenSource.Token);
return await task;
}
catch (OperationCanceledException)
{
throw new TimeoutException($"Operation {operation.Id} timed out after {operation.TimeoutMs}ms");
}
private static async Task<object> ExecuteOperationWithTimeoutAsync(QueuedOperation operation)
{
var executeTask = Task.Run(() => ExecuteOperation(operation));
var timeoutTask = Task.Delay(operation.TimeoutMs);
var completedTask = await Task.WhenAny(executeTask, timeoutTask).ConfigureAwait(false);
if (completedTask != executeTask)
{
throw new TimeoutException($"Operation {operation.Id} timed out after {operation.TimeoutMs}ms");
}
return await executeTask.ConfigureAwait(false);
}
🤖 Prompt for AI Agents
In UnityMcpBridge/Editor/Helpers/OperationQueue.cs around lines 275-289, the
current implementation uses Task.Run with a CancellationTokenSource which only
affects task start, so long-running ExecuteOperation calls never time out;
replace this with an explicit timeout enforcement using Task.WhenAny: create a
Task for the operation (Task.Run(() => ExecuteOperation(operation),
CancellationToken.None)), create a timeout Task
(Task.Delay(operation.TimeoutMs)), await Task.WhenAny(operationTask,
timeoutTask), if operationTask completed return its result (await it to observe
exceptions), otherwise cancel the CancellationTokenSource (to attempt
cooperative cancellation of the operation), throw a TimeoutException with the
operation Id and TimeoutMs, and ensure you dispose the CancellationTokenSource
in a finally block.

Comment on lines +208 to 217
var scriptClassName = properties?["scriptClass"]?.ToString();
if (string.IsNullOrEmpty(scriptClassName))
return Response.Error(
"'scriptClass' property required when creating ScriptableObject asset."
);

Type scriptType = ComponentResolver.TryResolve(scriptClassName, out var resolvedType, out var error) ? resolvedType : null;
var scriptType = ComponentResolver.TryResolve(scriptClassName, out var resolvedType, out var error) ? resolvedType : null;
if (
scriptType == null
|| !typeof(ScriptableObject).IsAssignableFrom(scriptType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Restore the ComponentResolver import

ComponentResolver lives inside ManageGameObject. Without the using static MCPForUnity.Editor.Tools.ManageGameObject; import, this reference no longer resolves and the file fails to compile. Please bring that static import back (or qualify the calls).

Apply this diff:

 using UnityEditor;
 using UnityEngine;
 using MCPForUnity.Editor.Helpers; // For Response class
+using static MCPForUnity.Editor.Tools.ManageGameObject;

Based on learnings

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In UnityMcpBridge/Editor/Tools/ManageAsset.cs around lines 208 to 217, the code
references ComponentResolver (defined in ManageGameObject) but the static import
is missing causing compilation failures; restore the missing using static
MCPForUnity.Editor.Tools.ManageGameObject; at the top of the file or else fully
qualify calls to ComponentResolver (e.g.,
ManageGameObject.ComponentResolver.TryResolve) so the symbol resolves and the
file compiles.

Comment on lines +233 to +266
Debug.Log($"STUDIO: Executing operation {operation.Id} ({operation.Tool})");

// Execute the operation
var result = await Task.Run(() =>
{
try
{
switch (operation.Tool.ToLowerInvariant())
{
case "manage_script":
return Tools.ManageScript.HandleCommand(operation.Parameters);
case "manage_asset":
return Tools.ManageAsset.HandleCommand(operation.Parameters);
case "manage_scene":
return Tools.ManageScene.HandleCommand(operation.Parameters);
case "manage_gameobject":
return Tools.ManageGameObject.HandleCommand(operation.Parameters);
case "manage_shader":
return Tools.ManageShader.HandleCommand(operation.Parameters);
case "manage_editor":
return Tools.ManageEditor.HandleCommand(operation.Parameters);
case "read_console":
return Tools.ReadConsole.HandleCommand(operation.Parameters);
case "execute_menu_item":
return Tools.ExecuteMenuItem.HandleCommand(operation.Parameters);
default:
throw new ArgumentException($"Unknown tool: {operation.Tool}");
}
}
catch (Exception e)
{
throw new Exception($"Operation {operation.Id} failed: {e.Message}", e);
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Execute queue operations on the main thread.

ExecuteOperationsWithYield runs every tool handler inside Task.Run, so Unity work now executes on a thread‑pool worker. Most of the handlers you invoke (Tools.ManageScript, Tools.ManageAsset, Tools.ExecuteMenuItem, etc.) touch UnityEditor/UnityEngine APIs that must stay on the main thread; calling them off-thread will promptly throw UnityException (“get_activeScene can only be called from the main thread”) or corrupt editor state. This path also sidesteps the timeout/async handling already implemented in OperationQueue.ExecuteBatchAsync(). Please drop the Task.Run execution and reuse the existing queue dispatcher (e.g., schedule await OperationQueue.ExecuteBatchAsync() via EditorApplication.delayCall) so execution happens on the editor thread with the built-in timeout safeguards.

@msanatan
Copy link
Contributor

Please refer to this comment on an earlier PR: #372 (comment)

@msanatan msanatan closed this Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants