Repository navigation
Add code scanning alert update tool - #3888
Open
belaltaher8 wants to merge 2 commits into
Open
belaltaher8 wants to merge 2 commits into
belaltaher8 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Missing schema descriptions and unnamed dismissal-field decoding errors leave generated documentation incomplete and callers without clear guidance on which argument to fix.
2 open issues
What changed in this PR
Adds update_code_scanning_alert to the opt-in code_security toolset, extending existing alert reads with write operations while excluding the tool from read-only mode.
Changes:
- Supports reopening, dismissal, delegated dismissal requests, and assignee replacement or clearing.
- Validates exact alert IDs and inputs, uses a request-local API version, and returns a limited, security-labeled response.
- Adds registration, scope and schema coverage, generated documentation, and security-triage guidance.
| File | Description |
|---|---|
README.md |
Documents the new tool and parameters. |
pkg/skills/catalog/tools.go |
Adds the tool to the security-triage catalog. |
pkg/skills/catalog/skills/security-alert-triage/SKILL.md |
Explains update workflows and result reporting. |
pkg/skills/catalog/skills/security-alert-triage/references/alert-sources.md |
Lists update support and delegated-dismissal behavior. |
pkg/github/update_code_scanning_alert.go |
Implements validation, authenticated updates, and limited results. |
pkg/github/update_code_scanning_alert_test.go |
Covers updates, validation, exact IDs, errors, and registration. |
pkg/github/typed_security_outputs_test.go |
Registers the new output schema for verification. |
pkg/github/tools.go |
Adds the tool to the server inventory. |
pkg/github/__toolsnaps__/update_code_scanning_alert.snap |
Records tool metadata and schemas. |
cmd/github-mcp-server/main_test.go |
Checks scope listing and read-only exclusion. |
Review effort: Max (adaptive)
8 of 14 tasks
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
belaltaher8
force-pushed
the
belaltaher8-oss-code-scanning-alert-update
branch
from
November 18, 2026 20:05
6e647f8 to
931f6c7
Compare
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
Add
update_code_scanning_alertfor reopening, dismissing, requesting delegated dismissal, and replacing assignees through GitHub's public REST API. Depends on #3887; this PR contains only the code-scanning layer.Why
Code scanning alerts can currently be read but not updated through this server. This adds an opt-in write tool without changing existing read tools.
What changed
2022-11-28schema supports these fields.code_security, exclude it from read-only mode, requiresecurity_events, and attach the existing security-alert IFC label to successful results.get_code_scanning_alertbefore retrying. No automatic retries or follow-up writes are added.MCP impact
update_code_scanning_alertrequires separateowner,repo, andalertNumber, plus state or assignees. Dismissal requires a non-null reason;create_request: trueadditionally requires dismissed state. Explicit null dismissal fields and empty assignee arrays retain their API meaning. Unknown fields, including agent configuration, are rejected.Prompts tested (tool changes only)
Prompt-equivalent registered MCP calls were tested against mocked HTTP responses in legacy and modern protocol eras; natural-language routing and live GitHub writes were not run.
Security / limits
Uses the authenticated client and existing GitHub error handling for non-success responses. GitHub enforces repository permissions, delegated dismissal policy, and agentic Autofix eligibility; there are no fallback writes, identity bypasses, licensing changes, or agent-configuration inputs. Copilot assignment may consume Code Security AI Credits and Actions minutes and does not prove a session or pull request exists.
Results exclude code snippets and full alert payloads. Comments are limited to 280 characters. Original JSON is validated before numeric conversion and reread in the handler, preserving IDs through int64 maximum and rejecting fractional/overflowing targets. Tool schemas avoid unsupported top-level combinators.
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./script/testCommands run and results:
script/lint— passed, 0 issues, including after rebasing onto the updated parent.script/test— passed, full race suite (go test -race ./...), including after rebasing onto the updated parent.UPDATE_TOOLSNAPS=true go test ./...— passed during initial implementation;UPDATE_TOOLSNAPS=true go test ./pkg/github -run TestUpdateCodeScanningAlert -count=1— passed for the field-description update.go test ./pkg/github -run TestUpdateCodeScanningAlert -count=1— passed for the final client-version and uncertain-response regressions.go test ./pkg/inventory ./pkg/scopes ./pkg/skills/catalog ./cmd/github-mcp-server -count=1— passed.script/generate-docs— passed after the final rebase; generated files are current.go build ./cmd/github-mcp-server ./cmd/mcpcurl— passed after the final rebase.go run ./cmd/github-mcp-server list-scopes --toolsets=all --output=json— passed; combined inventory contains 149 tools, including both alert-update tools withsecurity_events.Focused registered-call coverage includes exact IDs above 2^53 and at int64 maximum, fractional/overflow rejection, nullable fields, actual returned state, assignee replacement/clearing, upstream errors, IFC labels, read-only exclusion, schema compatibility, field-specific decoding diagnostics, and one-PATCH uncertain-success handling. Configured-client tests cover default github.com routing and an actual HTTP server configured through
WithEnterpriseURLs, preserving/api/v3, authentication and the client's default API version in both protocol eras. The custom PATCH DTO remains necessary because the SDK update type requires state and lacks assignees, create_request and explicit-null support. Dependabot implementation, tests, and snapshot are unchanged relative to the updated parent. Live PAT-dependent e2e tests were not run.Docs
Regenerated README tool documentation, including state and dismissal-comment guidance, and updated the security-alert source reference.
Skills
Updated
security-alert-triageand its optional tool catalog entry with nullable fields, delegated-dismissal policy, assignees, and actual-result reporting.