-
Notifications
You must be signed in to change notification settings - Fork 693
Description
Description
The execute_custom_tool handling in the /api/command REST endpoint is currently nested inside the "no unity_instance" else branch. This causes custom tool execution to be bypassed when a caller specifies both unity_instance and command_type: "execute_custom_tool". The request falls through to PluginHub.send_command instead of going through custom tool resolution and execution.
Affected Code
- File:
Server/src/main.py - Route:
/api/command(POST) - Lines: Approximately 406-457 (after PR Remote server auth #644)
Context
This is a pre-existing logic issue in the CLI REST endpoint. The bug was identified during review of PR #644:
- PR: Remote server auth #644
- Review comment: Remote server auth #644 (comment)
Expected Behavior
When command_type: "execute_custom_tool" is specified, the custom tool execution path should run regardless of whether unity_instance is provided.
Suggested Fix
Move the execute_custom_tool block outside the if/else so it runs before the final PluginHub.send_command call. The block should:
- Detect
command_type == "execute_custom_tool" - Validate params/tool_name/tool_params
- Use the already-resolved session_id/session_details
- Compute
unity_instance_hintfromunity_instanceorsession_details.hash - Call
resolve_project_id_for_unity_instanceandCustomToolService.execute_tool - Return the result without falling through to
PluginHub.send_command
Reported by: @msanatan
Identified by: CodeRabbit review