Fix call_workflow tool registration in HTTP safe-outputs MCP server#21124
Fix call_workflow tool registration in HTTP safe-outputs MCP server#21124
Conversation
The HTTP safe-outputs MCP server was not registering generated call_workflow tools because its predefined-tool registration loop only handled _workflow_name (dispatch_workflow) but had no parallel branch for _call_workflow_name (call_workflow). Add isCallWorkflowTool detection and an else-if branch gated on safeOutputsConfig.call_workflow, mirroring the existing dispatch_workflow handling. Also update the fallback skip-log to include _call_workflow_name metadata for easier diagnostics. Add regression tests in safe_outputs_mcp_server_http_call_workflow.test.cjs verifying: - call_workflow tools register when config.call_workflow exists - call_workflow tools are skipped when config.call_workflow is absent - multiple call_workflow tools all register correctly - falsy config.call_workflow prevents registration - call_workflow and dispatch_workflow tools register independently - tools/list includes/excludes call_workflow tools based on config Fixes #<issue> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a regression/bug where the HTTP safe-outputs MCP server failed to register dynamically generated call_workflow tools (those identified via _call_workflow_name metadata), causing them to be silently skipped during tool registration.
Changes:
- Add
isCallWorkflowTooldetection and asafeOutputsConfig.call_workflow-gated registration path insafe_outputs_mcp_server_http.cjs. - Improve the “skipping tool” debug log to include
_call_workflow_namemetadata when present. - Add a regression test suite covering
call_workflowregistration scenarios and inclusion/exclusion behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| actions/setup/js/safe_outputs_mcp_server_http.cjs | Adds explicit call_workflow tool detection/registration logic to prevent generated workflow-specific tools from being dropped. |
| actions/setup/js/safe_outputs_mcp_server_http_call_workflow.test.cjs | Adds regression tests to ensure call_workflow tools are registered only when config.call_workflow is present/truthy and appear in the effective tool list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
@copilot add tests |
…ation Add 6 integration tests that call createMCPServer directly with real temp config/tools files (same pattern as safe_outputs_bootstrap.test.cjs) and verify the actual server.tools Map: - registers a call_workflow tool when config.call_workflow is present - does NOT register when config.call_workflow is absent - registers all tools for multiple configured workers - registers call_workflow and regular tools together - registers call_workflow and dispatch_workflow tools independently - registered tool has a callable handler that writes call_workflow output Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added 6 integration tests in commit
All 15 tests pass (9 logic-level + 6 integration). |
The HTTP safe-outputs MCP server silently dropped all generated
call_workflowtools at registration time. The compiler andsafe_outputs_tools_loader.cjsboth handle_call_workflow_namecorrectly, butsafe_outputs_mcp_server_http.cjsonly had a special-case branch for_workflow_name(dispatch_workflow). Tools likegeneric_workerfell through toenabledTools.has(tool.name), which always fails because the config key iscall_workflow, not the workflow-specific tool name.Changes
safe_outputs_mcp_server_http.cjs: AddedisCallWorkflowTooldetection and anelse ifbranch gated onsafeOutputsConfig.call_workflow, mirroring the existingisDispatchWorkflowToolbranch. Updated the fallback skip-log to surface_call_workflow_namemetadata.safe_outputs_mcp_server_http_call_workflow.test.cjs: Regression tests at two levels:dispatch_workflow, andtools/listinclusion/exclusion.createMCPServerdirectly with real temp config and tools files, asserting against the actualserver.toolsMap. Scenarios include: single and multiple workers, combinedcall_workflow+ regular tools,call_workflow+dispatch_workflowindependence, and end-to-end handler invocation verifying the JSONL output written to disk.💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.