Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Oct 7, 2025
| const fs = require("fs"); | ||
| const path = require("path"); | ||
| const crypto = require("crypto"); | ||
| const { execSync } = require("child_process"); |
Collaborator
There was a problem hiding this comment.
@copilot use exec.getExecOutput who is defined in @actions/core (it is already ambient in the actions/github-script execution environment)
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update MCP tool handlers to use current branch if missing
Make branch parameter optional in create_pull_request and push_to_pull_request_branch MCP tools
Oct 7, 2025
pelikhan
approved these changes
Oct 7, 2025
Copilot stopped work on behalf of
pelikhan due to an error
October 7, 2025 21:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Updates the
create_pull_requestandpush_to_pull_request_branchMCP tool handlers to make the "branch" parameter optional. When the branch parameter is not provided or is empty, the current git branch is automatically resolved usinggit rev-parse --abbrev-ref HEAD.Problem
Previously, both MCP tools required an explicit "branch" parameter:
This created unnecessary friction when the AI agent was already working on a specific branch and just wanted to create a PR or push changes from the current branch.
Solution
The branch parameter is now optional for both tools. When omitted, the MCP server automatically resolves the current git branch:
Implementation Details
Added
getCurrentBranch()helper function that executesgit rev-parse --abbrev-ref HEADto resolve the current branch nameCreated custom handlers for both tools:
createPullRequestHandler()- Resolves current branch when not providedpushToPullRequestBranchHandler()- Resolves current branch when not providedUpdated tool schemas:
Backward Compatibility
The changes are fully backward compatible. Existing calls that provide an explicit "branch" parameter will continue to work unchanged:
Testing
Files Changed
pkg/workflow/js/safe_outputs_mcp_server.cjs- Core implementationpkg/workflow/js/safe_outputs_mcp_server_defaults.test.cjs- Test coverageOriginal prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.