Fix dispatch_workflow MCP handler to wrap inputs per schema #13259
+87
−17
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.
Fix dispatch_workflow inputs structure ✅
Problem: When dispatch_workflow tools are called via MCP, the workflow inputs were being spread at the top level instead of being wrapped in an "inputs" property, causing the handler to not recognize them.
Root Cause: The handler creation code in
safe_outputs_tools_loader.cjswas spreading tool arguments (...args) directly alongsideworkflow_name, instead of wrapping them in aninputsobject.Before (Incorrect):
{"test_param":"value","workflow_name":"test-workflow","type":"dispatch_workflow"}After (Correct):
{"inputs":{"test_param":"value"},"workflow_name":"test-workflow","type":"dispatch_workflow"}Plan:
safe_outputs_tools_loader.cjsattachHandlersfunction to wrap args ininputssafe_outputs_tools_loader.test.cjsto verify the fixFiles Changed:
actions/setup/js/safe_outputs_tools_loader.cjs- Fixed handler to wrap args ininputsactions/setup/js/safe_outputs_tools_loader.test.cjs- Added tests for empty object and undefined argsactions/setup/js/dispatch_workflow.test.cjs- Added test for missing inputs propertyWorkflows with No Inputs: The fix properly handles workflows that have no input parameters:
{}(empty object) → produces{ inputs: {}, workflow_name: "..." }undefined→ produces{ workflow_name: "..." }(no inputs property)dispatch_workflowhandler handles both cases correctly by defaulting to an empty objectSecurity Summary: No security issues found or introduced by this change.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.