Skip to content

manage_build scenes action throws Newtonsoft JValue parsing exception #1003

@reefbarman

Description

@reefbarman

Summary

manage_build with action: "scenes" throws a JToken/JValue parsing exception instead of updating Build Settings scenes.

Environment

  • Unity: 6000.3.7f1
  • Package: com.coplaydev.unity-mcp (@0bad2d0f59a0, from stack path)
  • OS: Windows 11 x64

Repro 1 (JSON array string)

Call:

{
  "action": "scenes",
  "scenes": "[\"Assets/Scenes/MainScene.unity/MainScene.unity\"]"
}

Actual error:

{
  "success": false,
  "code": "Cannot access child value on Newtonsoft.Json.Linq.JValue.",
  "error": "Cannot access child value on Newtonsoft.Json.Linq.JValue.",
  "data": {
    "stackTrace": "  at Newtonsoft.Json.Linq.JToken.get_Item (System.Object key) [0x00015] in <761cf2a144514d2291a678c334d49e9b>:0 \r\n  at MCPForUnity.Editor.Tools.ManageBuild.HandleScenes (MCPForUnity.Editor.Helpers.ToolParams p) [0x00095] in .\\Library\\PackageCache\\com.coplaydev.unity-mcp@0bad2d0f59a0\\Editor\\Tools\\ManageBuild.cs:321 \r\n  at MCPForUnity.Editor.Tools.ManageBuild.HandleCommand (Newtonsoft.Json.Linq.JObject params) [0x0019b] in .\\Library\\PackageCache\\com.coplaydev.unity-mcp@0bad2d0f59a0\\Editor\\Tools\\ManageBuild.cs:44 "
  }
}

Repro 2 (comma-separated string)

Call:

{
  "action": "scenes",
  "scenes": "Assets/Scenes/MainScene.unity/MainScene.unity"
}

Actual result: same exception.

Expected result

action: "scenes" should accept documented input format (JSON array or comma-separated, whichever is intended) and update Build Settings scene list without throwing.

Current impact / workaround

Could not add scene via MCP tool. Manual Unity Editor workaround:

  • File → Build Settings → Add Open Scenes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions