Skip to content

Order list_label results by issue count (descending) - #2974

Open
iulia-b wants to merge 2 commits into
mainfrom
feature/list-labels-order-by-issue-count
Open

Order list_label results by issue count (descending)#2974
iulia-b wants to merge 2 commits into
mainfrom
feature/list-labels-order-by-issue-count

Conversation

@iulia-b

@iulia-b iulia-b commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Sends orderBy: {field: ISSUE_COUNT, direction: DESC} on the GraphQL labels query so the most-used labels (by issue count) are returned first. ISSUE_COUNT is accepted by the GitHub GraphQL API but is not part of the public schema docs or the githubv4 client library's LabelOrderField constants, so it is defined locally.

Summary

Orders  list_label  results by issue count in descending order, returning the repository’s most-used labels first. Updates the tool description, tests, snapshot, and generated documentation accordingly.

Why

What changed

  • tool description
  • default order of fetching labels in list_label

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: 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

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Sends orderBy: {field: ISSUE_COUNT, direction: DESC} on the GraphQL
labels query so the most-used labels (by issue count) are returned
first. ISSUE_COUNT is accepted by the GitHub GraphQL API but is not
part of the public schema docs or the githubv4 client library's
LabelOrderField constants, so it is defined locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@iulia-b
iulia-b marked this pull request as ready for review July 30, 2026 08:04
@iulia-b
iulia-b requested a review from a team as a code owner July 30, 2026 08:04
Copilot AI review requested due to automatic review settings July 30, 2026 08:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Orders list_label results by descending issue count so frequently used labels appear first.

Changes:

  • Adds server-side GraphQL ordering.
  • Updates tests, tool snapshot, and generated documentation.
Show a summary per file
File Description
README.md Documents the new ordering.
pkg/github/labels.go Adds and applies issue-count ordering.
pkg/github/labels_test.go Verifies GraphQL ordering parameters.
pkg/github/__toolsnaps__/list_label.snap Updates the tool description snapshot.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread pkg/github/labels.go
Comment on lines +137 to 140
Description: t("TOOL_LIST_LABEL_DESCRIPTION", "List labels from a repository, ordered by issue count (descending) so the most-used labels are returned first"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_LIST_LABEL_DESCRIPTION", "List labels from a repository"),
ReadOnlyHint: true,
@iulia-b iulia-b self-assigned this Jul 30, 2026

@kelsey-myers kelsey-myers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copilot's comment makes sense but other than that, looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants