Repository navigation
Add public agent automation tools - #3719
Conversation
| return utils.NewToolResultError(fmt.Sprintf("GitHub agent automations returned unexpected status %d", httpResponse.StatusCode)), nil, nil | ||
| } | ||
|
|
||
| result := utils.NewToolResultText(string(response)) |
There was a problem hiding this comment.
I didn't make the suggested constructor swap. This tool already returns json.RawMessage as typed output, so modern MCP clients receive structured content; the inventory layer also renders JSON text for compatibility. There is no NewToolResultJSON helper here, and changing the result constructor alone would not turn attacker-controlled fields into trusted data or remove the text representation. I haven't added a robust output-trust boundary, so I'm leaving this thread open rather than claiming it's fixed.
There was a problem hiding this comment.
🟡 Changes recommended
Reserved automation IDs can bypass configured tool exclusions, and automation names reach clients without display-text sanitization.
2 open issues
What changed in this PR
Adds seven read-only automation tools to the GitHub MCP Server’s copilot toolset, available only through explicit agent_automations opt-in.
Changes:
- Adds repository automation, revision, catalog, and configuration reads.
- Registers the tools behind a feature flag that Insiders mode does not enable automatically.
- Adds handler tests, schema snapshots, and opt-in documentation.
| File | Description |
|---|---|
| README.md | Links to feature-flag documentation. |
| pkg/github/tools.go | Registers seven automation tools. |
| pkg/github/feature_flags.go | Adds the public opt-in flag. |
| pkg/github/feature_flags_test.go | Tests explicit opt-in and Insiders exclusion. |
| pkg/github/agent_automations.go | Implements automation read tools and shared request handling. |
| pkg/github/agent_automations_test.go | Tests handlers, availability, schemas, errors, and uncached configuration reads. |
| pkg/github/__toolsnaps__/list_available_automation_triggers.snap | Records the trigger catalog schema. |
| pkg/github/__toolsnaps__/list_available_automation_tools.snap | Records the tool catalog schema. |
| pkg/github/__toolsnaps__/list_automations.snap | Records listing inputs and output schema. |
| pkg/github/__toolsnaps__/list_automation_revisions.snap | Records revision pagination and output schema. |
| pkg/github/__toolsnaps__/get_automations_configuration_for_repository.snap | Records required configuration booleans. |
| pkg/github/__toolsnaps__/get_automation.snap | Records automation retrieval schema. |
| pkg/github/__toolsnaps__/get_automation_revision.snap | Records revision retrieval schema. |
| docs/feature-flags.md | Documents opt-in behavior and tool parameters. |
Review effort: Balanced (auto)
| if err != nil { | ||
| return utils.NewToolResultErrorFromErr("failed to sanitize GitHub agent automation response", err), nil, nil | ||
| } | ||
| return utils.NewToolResultText(string(sanitizedResponse)), sanitizedResponse, nil |
There was a problem hiding this comment.
I kept the JSON text representation for clients that consume Content and the structured output for clients that consume typed data. Replacing the text with a fixed message would break the former, while attacker-controlled structured fields could still reach a model through clients that include structuredContent; changing the result constructor alone would not establish a trust boundary. The display-name sanitization is not content sanitization, and automation prompts/descriptions remain untrusted. I have not solved that broader client/data-boundary issue, so this stays open rather than claiming the suggested change would make the payload safe.
Expose repository automation and revision reads plus the repository-scoped tool and trigger catalogs through the public REST API. Pin requests to the documented API version so these preview endpoints receive their published schemas. Co-authored-by: Copilot App <[email protected]>
Keep the repository automation tool surface hidden unless users explicitly enable agent_automations, including in Insiders mode. Co-authored-by: Copilot App <[email protected]>
Expose the repository's automation and trigger policies through the existing opt-in automation tool surface. Keep the read caller-specific by requesting it for every invocation. Co-authored-by: Copilot App <[email protected]>
Reject path dot segments and reserved automation subroutes before building requests, and sanitize automation display names in the shared read response. Preserve identifiers, cursors, and prompt content. Co-authored-by: Copilot App <[email protected]>
Register the repository automation tools in a dedicated, non-default copilot_automations toolset instead of the default copilot toolset, matching the toolset the remote server already uses for these tools. Using them now requires --toolsets=copilot_automations (or all) alongside --features=agent_automations. Co-authored-by: Copilot <[email protected]> Copilot-Session: f921ed41-2ec0-4075-a572-7692f9529b7e
4f0a5bd to
86c5186
Compare
The skills catalog now requires every registered tool to map to a bundled skill or carry an explicit exemption. Co-authored-by: Copilot <[email protected]> Copilot-Session: f921ed41-2ec0-4075-a572-7692f9529b7e
Expose create, partial update, and delete operations for repository automations using GitHub's published REST fields and status codes. Co-authored-by: Copilot App <[email protected]>
Bind the confirmation to the exact API request and reject missing, declined, mismatched, expired, or changed confirmations before sending a delete request. Co-authored-by: Copilot App <[email protected]>
Show the exact create/update request details for explicit approval and bind confirmation to the request before sending mutations. Co-authored-by: Copilot App <[email protected]>
Keep request values out of MCP confirmation messages so untrusted prompt text cannot steer the confirmation step. Show only escaped targets and field names, while preserving the original REST payload. Co-authored-by: Copilot App <[email protected]>
Apply shared automation ID and repository path checks before confirming create, update, and delete requests so dot segments and reserved API routes cannot retarget writes. Co-authored-by: Copilot App <[email protected]>
HTTP mode now excludes repository automation writes when the multi-round-trip request-state key is unavailable, matching the protected confirmation flow. Document the key requirement and cover inventory filtering. Co-authored-by: Copilot App <[email protected]>
The skills catalog now requires every registered tool to map to a bundled skill or carry an explicit exemption. Co-authored-by: Copilot <[email protected]> Copilot-Session: f921ed41-2ec0-4075-a572-7692f9529b7e
Starts a manual automation task through the repository-scoped REST endpoint and returns GitHub's accepted task response. Co-authored-by: Copilot App <[email protected]>
Show the target and supplied context in MCP form elicitation, bind approval to the exact run request, and enforce the public API context length limit before submitting the task. Co-authored-by: Copilot App <[email protected]>
Keep caller-controlled run context out of the MCP confirmation message while preserving the original task request. Show only its character count so untrusted instructions are not echoed into the approval prompt. Co-authored-by: Copilot App <[email protected]>
Reject invalid and reserved path segments before requesting run confirmation. If the task endpoint accepts a request but returns no task body, report the HTTP status and advise verifying the outcome before retrying. Co-authored-by: Copilot App <[email protected]>
Hide run_automation in HTTP mode when multi-round-trip request-state protection is unavailable, alongside the automation management mutations. Co-authored-by: Copilot App <[email protected]>
The skills catalog now requires every registered tool to map to a bundled skill or carry an explicit exemption. Co-authored-by: Copilot <[email protected]> Copilot-Session: f921ed41-2ec0-4075-a572-7692f9529b7e
197f417 to
5361370
Compare


Summary
Adds the Copilot Automation tools to the public MCP server, backed by GitHub's public REST API: seven read tools,
create_automation,update_automation,delete_automationandrun_automation. All eleven tools live in the non-defaultcopilot_automationstoolset and require the explicitagent_automationsopt-in flag.Why
Ports the hosted Copilot Automation tools to the open-source server so local and hosted users share one implementation (github/sweagentd#16692). This PR now contains the whole change in one place and supersedes #3723 (write tools) and #3724 (run tool). Automation group tools and the Copilot task status tool follow in separate PRs.
What changed
ownerandrepo.create_automation, partialupdate_automation(keeps explicitfalsevalues and empty arrays) anddelete_automation, handling the API's 201 and 204 responses.run_automation: manual-only event, optional context limited to 10,000 characters, handles202 Accepted.namedisplay fields in text and structured responses.copilot_automationstoolset and theagent_automationsflag (allowlisted, not enabled by Insiders mode).MCP impact
agent_automationsoff the tools are absent from listings and direct calls fail; mutations require an accepted MCP form bound to their exact arguments.copilot_automationstoolset, available only withagent_automationsenabled.Prompts tested (tool changes only)
TestAgentAutomationReadTools,TestAgentAutomationWriteTools, andTestRunAutomationassert methods, paths, query strings, the API-version header, request bodies and responses.TestDeleteAutomationRequiresMatchingConfirmation,TestRunAutomationConfirmationBindsRequest,TestAutomationMutationsRequireFormElicitation, the request-state tests and the path-validation tests verify that declined, changed or unprotected requests send nothing.TestAgentAutomationFeatureFlagAvailabilityverifies the tools stay hidden by default, in Insiders mode and outside thecopilot_automationstoolset, appear with the flag, and that read-only mode keeps only read tools.Security / limits
Tool renaming
deprecated_tool_aliases.goNote: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint: passed../script/test: passed (go test -race ./...).script/generate-docsleaves no drift.Docs