Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,17 @@ For negotiated supported protocol versions `2026-07-28` or newer, the consolidat
- `state`: Filter code scanning alerts by state. Defaults to open (string, optional)
- `tool_name`: The name of the tool used for code scanning. (string, optional)

- **update_code_scanning_alert** - Update code scanning alert
- **OAuth Challenge Scopes**: `security_events`
- `alertNumber`: Code scanning alert number. (integer, required)
- `assignees`: Replace assignees with human usernames or copilot-swe-agent[bot]. [] unassigns everyone. Copilot assignment starts remediation, not just ownership. (string[], optional)
- `create_request`: Attempt a delegated dismissal request with state:dismissed and a reason. Does not bypass policy. (boolean, optional)
- `dismissed_comment`: Optional dismissal comment, up to 280 characters, or null. Requires a state or assignee update; not a standalone comment API. (string | null, optional)
- `dismissed_reason`: Required and non-null when dismissing. (string | null, optional)
- `owner`: Repository owner. (string, required)
- `repo`: Repository name. (string, required)
- `state`: Reopen or dismiss the alert. Omission leaves state unchanged. (string, optional)

</details>

<details>
Expand Down
19 changes: 19 additions & 0 deletions cmd/github-mcp-server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,25 @@ func TestDependabotUpdateListScopes(t *testing.T) {
}
}

func TestCodeScanningUpdateListScopes(t *testing.T) {
for _, readOnly := range []bool{false, true} {
inv, err := github.NewInventory(translations.NullTranslationHelper).
WithToolsets([]string{"code_security"}).WithReadOnly(readOnly).Build()
require.NoError(t, err)
output := collectToolScopes(inv, readOnly)
if readOnly {
assert.NotContains(t, output.ScopesByTool, "update_code_scanning_alert")
continue
}
assert.Equal(t, []string{"security_events"}, output.ScopesByTool["update_code_scanning_alert"])
assert.Contains(t, output.ToolsByScope["security_events"], "update_code_scanning_alert")
assert.Contains(t, output.Tools, ToolScopeInfo{
Name: "update_code_scanning_alert", Toolset: "code_security",
ReadOnly: false, ChallengeScopes: []string{"security_events"},
})
}
}

func TestSchemaTypeString(t *testing.T) {
tests := []struct {
name string
Expand Down
131 changes: 131 additions & 0 deletions pkg/github/__toolsnaps__/update_code_scanning_alert.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"annotations": {
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Update code scanning alert"
},
"description": "Reopen, dismiss, or replace assignees on a code scanning alert. Requires state or assignees. Dismissal requires a non-null dismissed_reason. Omitted fields are unchanged; [] clears all assignees. create_request:true requires state:dismissed and attempts a delegated dismissal request, not necessarily dismissal. The returned state and assignees are the actual API result; no request approval or agent session is inferred. Assigning copilot-swe-agent[bot] starts agentic remediation and may open a draft pull request, consuming Code Security AI Credits and Actions minutes. Repository permissions, delegated dismissal policy, and agentic Autofix eligibility are enforced by GitHub; errors are returned without fallback.",
"inputSchema": {
"additionalProperties": false,
"properties": {
"alertNumber": {
"description": "Code scanning alert number.",
"minimum": 1,
"type": "integer"
},
"assignees": {
"description": "Replace assignees with human usernames or copilot-swe-agent[bot]. [] unassigns everyone. Copilot assignment starts remediation, not just ownership.",
"items": {
"type": "string"
},
"type": "array"
},
"create_request": {
"description": "Attempt a delegated dismissal request with state:dismissed and a reason. Does not bypass policy.",
"type": "boolean"
},
"dismissed_comment": {
"description": "Optional dismissal comment, up to 280 characters, or null. Requires a state or assignee update; not a standalone comment API.",
"maxLength": 280,
"type": [
"string",
"null"
]
},
"dismissed_reason": {
"description": "Required and non-null when dismissing.",
"enum": [
"false positive",
"won't fix",
"used in tests",
"mitigated",
null
],
"type": [
"string",
"null"
]
},
"owner": {
"description": "Repository owner.",
"minLength": 1,
"type": "string"
},
"repo": {
"description": "Repository name.",
"minLength": 1,
"type": "string"
},
"state": {
"description": "Reopen or dismiss the alert. Omission leaves state unchanged.",
"enum": [
"open",
"dismissed"
],
"type": "string"
}
},
"required": [
"owner",
"repo",
"alertNumber"
],
"type": "object"
},
"name": "update_code_scanning_alert",
"outputSchema": {
"additionalProperties": false,
"properties": {
"assignees": {
"description": "Actual API assignments, when returned. Empty means unassigned; omitted means the API did not report assignments.",
"items": {
"additionalProperties": false,
"properties": {
"login": {
"type": "string"
}
},
"required": [
"login"
],
"type": "object"
},
"type": [
"null",
"array"
]
},
"dismissed_reason": {
"type": [
"null",
"string"
]
},
"html_url": {
"type": "string"
},
"number": {
"description": "Exact alert number as a decimal string to preserve integer precision.",
"type": "string"
},
"state": {
"description": "Actual API state, not the requested state. An open alert is not dismissed even when a dismissal request was attempted.",
"type": [
"null",
"string"
]
}
},
"required": [
"number",
"state",
"html_url"
],
"type": [
"null",
"object"
]
}
}
1 change: 1 addition & 0 deletions pkg/github/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func AllTools(t translations.TranslationHelperFunc, opts ...ToolOption) []invent
// Code security tools
GetCodeScanningAlert(t),
ListCodeScanningAlerts(t),
UpdateCodeScanningAlert(t),

// Secret protection tools
GetSecretScanningAlert(t),
Expand Down
2 changes: 2 additions & 0 deletions pkg/github/typed_security_outputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func securityOutputSchema(t *testing.T, name string) *jsonschema.Schema {
schema, err = jsonschema.For[*CodeQualityFindingOutput](nil)
case "get_code_scanning_alert":
schema, err = jsonschema.For[*CodeScanningAlertOutput](nil)
case "update_code_scanning_alert":
schema, err = jsonschema.For[*CodeScanningAlertUpdateOutput](nil)
case "list_code_scanning_alerts":
schema, err = jsonschema.For[[]*CodeScanningAlertOutput](nil)
case "get_secret_scanning_alert":
Expand Down
Loading
Loading