Repository navigation
Add list_code_quality_findings tool to code_quality toolset - #3564
Draft
carogalvin wants to merge 2 commits into
Draft
carogalvin wants to merge 2 commits into
carogalvin wants to merge 2 commits into
Conversation
Add a read-only tool that lists code quality findings for a repository
via GET /repos/{owner}/{repo}/code-quality/findings. It supports the
endpoint's filters: state (open or dismissed, defaulting to open),
direction (asc or desc), and cursor pagination (perPage, after).
The tool follows the list_dependabot_alerts pattern: cursor pagination
schema, defaults stripped from the validation schema, a typed output
with findings and pageInfo, and the same scopes as
get_code_quality_finding. Like get_code_quality_finding, it attaches
no IFC label.
Includes unit tests, the tool snapshot, and regenerated README docs.
Co-authored-by: Copilot App <[email protected]>
The endpoint sorts findings by creation date only, so describe the direction values in those terms. Co-authored-by: Copilot App <[email protected]>
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 a read-only
list_code_quality_findingstool to thecode_qualitytoolset. It lists a repository's code quality findings throughGET /repos/{owner}/{repo}/code-quality/findingsand supports thestateanddirectionfilters plus cursor pagination.Why
Closes #3560
What changed
ListCodeQualityFindingsinpkg/github/code_quality.go, modelled onlist_dependabot_alerts:WithCursorPagination(perPage,after) andNewToolWithSchemaOptions, withValidationInputSchema: inventory.CloneSchemaWithoutDefaults(schema).ReadOnlyHint: true.TOOL_LIST_CODE_QUALITY_FINDINGS_*.ownerandrepoare required.stateacceptsopenordismissedand defaults toopen.directionacceptsascordescand defaults todesc. These are the only filters the endpoint supports.CodeQuality.ListFindings, but the tool sends a rawclient.NewRequestto matchGetCodeQualityFindingand to return the REST JSON unchanged to legacy clients.ListCodeQualityFindingsInputandCodeQualityFindingsOutput(findingspluspageInfo) topkg/github/security_outputs.go:pageInfo.CodeQualityFindingOutputDTO.pkg/github/tools.go, right afterGetCodeQualityFinding.Test_ListCodeQualityFindingscovers the toolsnap, schema assertions, defaults, the state and direction filters, cursor passthrough, the returned next cursor, 403 and 404 responses, and missingownerorrepo.Linkheader includes arel="last"link with an emptybefore=value. pageInfo reads cursors only fromrel="next"andrel="prev", so it never returns that empty cursor. A test using the real header shape covers this.list_code_quality_findings.snap, and the README is regenerated.MCP impact
list_code_quality_findings. It is in the existingcode_qualitytoolset. There is no feature flag, and the default toolsets are unchanged.Prompts tested (tool changes only)
I tested these against a local build over stdio, using a repository that has Code Quality enabled.
hasNextPage: true, and anextCursor.after): returns the next 5 findings in the same order as the REST API, with both cursors.direction: asc): returns findings in ascending order.failed to list findings for repository 'octocat/Hello-World': ... 404 Not Found.state: closed: schema validation rejects it.Security / limits
get_code_quality_finding:scopes.PublicRead(scopes.Repo), which needs therepoOAuth scope for private repositories.get_code_quality_finding, which also has none. The other security list tools (Dependabot, code scanning, secret scanning) attachifc.LabelSecurityAlert(). If maintainers prefer that convention, adding the label is a one-line change.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, 0 issues../script/test: passed.UPDATE_TOOLSNAPS=true go test ./...also passed; it added one new snapshot and changed no others.Docs
script/generate-docs. The only change is the new tool entry.