Refactor Tool_Assets.Refresh to use ResponseCallTool and handle compilation lifecycle #231
+148
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the
Tool_Assets.Refreshmethod to follow the established pattern for MCP tools that can trigger Unity compilation, bringing it in line with other tools likeScript.DeleteandTestRunner.Run.Key Changes
Method Signature & Return Type:
[RequestID] string? requestId = nullparameterstringtoResponseCallToolCompilation Lifecycle Handling:
The method now properly handles Unity's compilation scenarios:
Improved Error Handling:
Testing:
Added comprehensive unit tests covering:
Benefits
TestRunner.RunandScript.DeleteScriptUtils.SchedulePostCompilationNotificationsystem that survives domain reloadsThis change ensures the MCP server receives appropriate responses for both synchronous operations (when no compilation occurs) and asynchronous operations (when Unity needs to recompile scripts after asset changes).
Fixes #230.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.