Skip to content

Tool: Remove Package #228

@IvanMurzak

Description

@IvanMurzak

Reference

  • Use the implementation in TestRunner.Run.cs as a reference.
  • Implement responses with ResponseCallTool and return Processing status when appropriate.

Method Signature

The method should accept:

  • string[] packageIds — list of package IDs to remove
  • string? requestId = null with attribute [RequestID]

Steps

  1. Iterate through packageIds:
    • Search for each package dependency in /Packages/manifest.json.
    • If a package is not found, add a response message:
      [Warning] Package {packageId} not found
      
      (Duplicate this message for each missing package.)
    • If found, mark it for removal and store the result:
      • success → deleted
      • warning → not found

  1. After processing all package IDs:
    • If at least one package was removed:
      1. Call:
        AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
      2. Return ResponseCallTool with Processing status.
      3. Handle scenarios:
        • No domain reload:
          • After refresh completes, generate a response message from stored deletion results.
          • Each package result must be on a new line.
        • Domain reload triggered:
          • Wait until completion.
          • If compilation fails → return an error.
          • If compilation succeeds → generate a response message from stored deletion results (each on a new line).

Final Step

  • In both scenarios, notify the MCP server with the generated response string.
  • The response must include the result for each package, with one package result per line.
  • This ensures the server is released from waiting for the operation to complete.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions