Repository navigation
Add read-only deployment history tools (list_deployments, list_deployment_statuses) - #3886
Open
Mystery01092000 wants to merge 1 commit into
Open
Mystery01092000 wants to merge 1 commit into
Mystery01092000 wants to merge 1 commit into
Conversation
Add list_deployments and list_deployment_statuses so an agent can check which commit reached an environment and whether that deployment succeeded, using GitHub's Deployments API. list_deployments supports the API's sha, ref, task and environment filters plus pagination. list_deployment_statuses returns a deployment's statuses newest first. Both are read-only, live in the repos toolset, sanitize free-text descriptions and carry an untrusted IFC label, since deployments are usually written by CI and preview integrations. Fixes github#3876
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The skill and tool guidance can misidentify live deployments by omitting latest-status success verification and failing to limit current-state claims to page 1.
2 open issues
What changed in this PR
Adds read-only deployment history tools to the GitHub MCP Server’s repos toolset, helping release audits distinguish merged or released commits from successful deployments.
Changes:
- Adds paginated deployment and status readers, with deployment filters and trimmed responses.
- Labels results as untrusted, with confidentiality based on repository visibility.
- Adds tests, tool snapshots, generated documentation, and release-preparation skill guidance.
| File | Description |
|---|---|
| README.md | Documents both tools and their parameters. |
| pkg/skills/catalog/tools.go | Maps both tools to the release-preparation skill. |
| pkg/skills/catalog/skills/release-preparation/SKILL.md | Adds deployment verification guidance. |
| pkg/ifc/ifc.go | Defines deployment security labels. |
| pkg/ifc/ifc_test.go | Tests public and private deployment labels. |
| pkg/github/tools.go | Registers both deployment tools. |
| pkg/github/helper_test.go | Adds deployment endpoint constants for mocks. |
| pkg/github/deployments.go | Implements deployment and status readers. |
| pkg/github/deployments_test.go | Tests schemas, responses, filters, errors, and labeling. |
| pkg/github/__toolsnaps__/list_deployments.snap | Captures the deployment-list tool schema. |
| pkg/github/__toolsnaps__/list_deployment_statuses.snap | Captures the deployment-status tool schema. |
Review effort: Balanced (adaptive)
| mcp.Tool{ | ||
| Name: "list_deployment_statuses", | ||
| Description: t("TOOL_LIST_DEPLOYMENT_STATUSES_DESCRIPTION", | ||
| "List the statuses of a deployment in a GitHub repository, newest first. The first status is the deployment's current state (e.g. success, failure, error, in_progress, queued, pending or inactive)."), |
Comment on lines
+70
to
+73
| - `sha` and `environment` on a deployment, with the newest `state` from | ||
| `list_deployment_statuses` — `list_deployments` filtered to the production | ||
| environment shows which commit is live now; merged or released does not mean | ||
| deployed. |
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
Adds two read-only tools to the
repostoolset,list_deploymentsandlist_deployment_statuses. With them an agent can check which commit reached an environment and whether that deployment succeeded.Why
The issue describes a release audit where the agent could see merged PRs, commits, checks and Actions runs, but not GitHub Deployment objects. Without them it could report what merged, but not whether it was actually deployed. The
deploymentanddeployment_statusfilters onactions_listonly select workflow triggers. They don't read the Deployment records that external deployment services create.Fixes #3876
What changed
list_deploymentswrapsGET /repos/{owner}/{repo}/deployments. It takes the API'ssha,ref,taskandenvironmentfilters pluspage/perPage, and returnsid,sha,ref,task,environment,description,creator,created_atandupdated_at, newest first.list_deployment_statuseswrapsGET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses. It returnsid,state,description,environment,environment_url,log_url,creatorand the timestamps, newest first, so the first entry is the deployment's current state.list_deploymentsalready returns every field the single-deployment endpoint has, so a third tool would mostly add to the tool count. Happy to add it if you'd like the 1:1 mapping from the issue.payloadis left out. It's arbitrary JSON that integrations fill with large blobs, and it isn't needed to answer "what's deployed where".sanitize.PlainText, like release names.ifc.LabelDeploymentlabel: untrusted integrity, with confidentiality following repository visibility. Deployments are written by CI and deployment integrations, and on public repositories those often run for fork PRs (preview deployments), so the ref, environment and description can carry outside text. It has the same shape asLabelActionsResult, but has its own name and doc comment so the reasoning stays next to it.release-preparationskill maps both tools as optional and now notes that merged or released does not mean deployed.tools.go, with toolsnaps and README regenerated.MCP impact
list_deploymentsandlist_deployment_statuses, both read-only.Prompts tested (tool changes only)
I ran these through the locally built server over stdio with
--read-only --toolsets repos, against live GitHub:list_deploymentswithenvironment: Production, perPage: 2returned deployment6228410729for5b8c866c…, created byvercel[bot], and the one before it.list_deployment_statusesfor6228410729returned one status withstate: failureand Vercel's description and log URL. This is the case the issue is about: the commit was handed to a deployment, but it didn't go live.tools/listin read-only mode.Security / limits
scopes.PublicRead(scopes.Repo), like the release and tag tools, and are read-only, so they are available with--read-only.payloadomitted, free text sanitized, results labelled untrusted.Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint: golangci-lint v2.14.0 reports 0 issues, and gofmt is clean../script/test:go test ./...passes. The new tests cover the filters and pagination query string, the no-filter defaults, field mapping, a missingdeployment_id, API errors, and the IFC label on public and private repositories.Docs
generate-docs.Skills
release-preparationmaps both tools and mentions checking the deployed commit.