Skip to content

Add custom field filtering to list_issues#2480

Draft
kelsey-myers wants to merge 3 commits into
mainfrom
kelsey/list-issues-field-filtering
Draft

Add custom field filtering to list_issues#2480
kelsey-myers wants to merge 3 commits into
mainfrom
kelsey/list-issues-field-filtering

Conversation

@kelsey-myers
Copy link
Copy Markdown

Summary

Extend list_issues so callers can filter issues by custom field values (single-select, text, number, date) alongside the existing label, state, and since filters.

Why

The IssueFilters.issueFieldValues argument is available in the GraphQL schema (gated by the issue_fields feature flag) and the existing list_issues tool returns field values on each issue, but there was no way to filter by them. Without this, agents have to fetch all issues and filter client-side which doesn't scale and is wasteful.

Stacked on top of #2466 — will retarget once that merges. Until then this PR shows both sets of commits.

What changed

  • Added field_filters array parameter to list_issues. Each entry takes a field_name plus exactly one of single_select_value, text_value, number_value, or date_value.
  • Threaded the filter through all four ListIssuesQuery* variants via a new issueFieldValues GraphQL variable. The variable is always sent (empty slice when no filters are supplied), the resolver treats an empty list as a no-op.
  • Added parseFieldFilters helper that validates exactly one typed value per filter and propagates type errors uniformly.
  • Set GraphQL-Features: issue_fields on outgoing requests via the existing GraphQLFeaturesTransport so the gated input type resolves while the flag is still rolling out. Safe to keep after rollout (no-op).
  • Unit tests cover all four query variants, all four value types, validation paths, number_value: 0 (must be treated as set), and a regression guard that the GraphQL-Features header is sent.

MCP impact

  • Tool schema or behavior changed

list_issues gains an optional field_filters parameter. Default behaviour (no field_filters) is unchanged.

Prompts tested (tool changes only)

  • "List the latest P1 priority issues in github/issues" — single-select filter
  • "List open issues in github/issues with the batch label" — labels-only path (regression)
  • "List the latest 10 issues in github/issues" — no filters (regression)
  • "List open issues updated since 2026-05-14" — since path (regression)
  • Combined: field_filters + labels + since across all four query variants
  • Each typed value field (single-select, text, number, date) exercised live against github/issues

Security / limits

  • Auth / permissions considered

No new auth surface. Uses the same scopes as list_issues today. The GraphQL-Features header opts into a schema-level feature flag and does not bypass any authorization.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

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

Docs

  • Updated (README / docs / examples)

script/generate-docs regenerated README.md and the list_issues toolsnap.

Adds Issues 2.0 custom field values to each issue returned by the
list_issues GraphQL query, exposed on MinimalIssue as field_values:
[{field, value}]. Filtering by field is a separate concern (needs the
GraphQL IssueFilters input updated upstream) and is not included here.

shurcooL/graphql's response decoder walks every inline fragment of a
union regardless of __typename, so IssueFieldNumberValue.value is
aliased to valueNumber to avoid a Float-vs-String type clash when the
runtime variant is, e.g., a SingleSelectValue.
@kelsey-myers
Copy link
Copy Markdown
Author

Sample Input:

{
  "owner": "github",
  "repo": "test-repo",
  "state": "OPEN",
  "field_filters": [
    {
      "field_name": "Priority",
      "single_select_value": "P1"
    }
  ],
  "orderBy": "UPDATED_AT",
  "direction": "DESC",
  "perPage": 20
}

Sample Output:

{
  ...issue,
  "field_values": [
    { "field": "Priority",   "value": "P1"   },
    { "field": "Visibility", "value": "High" },
    { "field": "Impact",     "value": "High" },
    { "field": "Effort",     "value": "Low"  }
  ]
}

@leuasseurfarrelds247-arch
Copy link
Copy Markdown

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.

2 participants