Refactor safe-outputs MCP server tools: Extract to JSON and pre-filter in Go#1486
Closed
Refactor safe-outputs MCP server tools: Extract to JSON and pre-filter in Go#1486
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Oct 10, 2025
| } | ||
|
|
||
| // Legacy ALL_TOOLS array - kept for backward compatibility when env var not provided | ||
| const ALL_TOOLS = [ |
Contributor
Author
There was a problem hiding this comment.
Removed legacy support. The ALL_TOOLS array and fallback logic have been completely removed from safe_outputs_mcp_server.cjs. The server now requires GITHUB_AW_SAFE_OUTPUTS_TOOLS environment variable and will throw an error if it's not provided. Tests updated accordingly. (commit 8dc873d)
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] Refactor TOOLS JSON payload into separate file
Refactor safe-outputs MCP server tools: Extract to JSON and pre-filter in Go
Oct 10, 2025
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Added logging to display filtered tools using |
21 tasks
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.
Problem
The safe-outputs MCP server had tool definitions hardcoded in JavaScript (
ALL_TOOLSarray insafe_outputs_mcp_server.cjs). This meant:Solution
This PR refactors the architecture to extract tool definitions into a separate JSON file and perform filtering in Go before passing to the JavaScript MCP server. Legacy support has been completely removed - the MCP server now requires the
GITHUB_AW_SAFE_OUTPUTS_TOOLSenvironment variable.Architecture Changes
Before:
After:
Key Changes
New JSON file (
pkg/workflow/data/safe_outputs_tools.json):hasHandlerflag for tools needing custom handlersGo filtering logic (
pkg/workflow/safe_outputs_tools.go)://go:embedSafeOutputToolDefinitionstructEnvironment variable (
GITHUB_AW_SAFE_OUTPUTS_TOOLS):JavaScript requirements:
hasHandlerflagBenefits
Example
For a workflow with only
create-pull-requestandupload-assetsconfigured:The MCP server will log on startup:
Testing
make agent-finishvalidation passesOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.