Skip to content

Include custom issue field values in list_issues response#2466

Open
kelsey-myers wants to merge 2 commits into
github:mainfrom
kelsey-myers:kelsey/list-issues-field-values
Open

Include custom issue field values in list_issues response#2466
kelsey-myers wants to merge 2 commits into
github:mainfrom
kelsey-myers:kelsey/list-issues-field-values

Conversation

@kelsey-myers
Copy link
Copy Markdown

@kelsey-myers kelsey-myers commented May 13, 2026

Summary

Adds Issues 2.0 custom field values (Priority, Visibility, Impact, etc.) to each issue returned by list_issues, exposed on MinimalIssue as field_values: [{field, value}].

Why

Issues 2.0 introduced custom fields (single-select, number, text, date) that are core to how teams triage and prioritise. Without them in the MCP response, an agent can list issues but has no way to see — or reason about — the values teams actually filter and sort by in the GitHub UI.

Fixes https://github.com/github/plan-track-agentic-toolkit/issues/121

What changed

  • IssueFragment now selects issueFieldValues(first: 25) (matches monolith IssueField::ORGANIZATION_ISSUE_FIELDS_LIMIT).
  • New IssueFieldRef type with a Name() method, resolving the field name across the 4-variant IssueFields union.
  • New IssueFieldValueFragment union fragment over IssueFieldDate|Number|SingleSelect|Text Value.
  • MinimalIssue gains FieldValues []MinimalIssueFieldValue (omitempty); each entry carries field, value, and a forward-compat values []string for the upcoming IssueFieldMultiSelectValue (see github/github#430793).
  • fragmentToMinimalIssueFieldValue converts the fragment to the minimal shape.
  • Tests cover both label-filtered and non-label-filtered query variants.

Live validation

Smoke-tested against production github.com via a local build of this server, against github/issues:

{ "number": 21640, "field_values": [
  {"field":"Priority","value":"P2"},
  {"field":"Visibility","value":"Medium"},
  {"field":"Impact","value":"Medium"},
  {"field":"Effort","value":"Medium"}
]}

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
    • list_issues response now includes an optional field_values array per issue. Additive only, omitted for issues without custom field values, so existing consumers aren't broken.
  • New tool added

Prompts tested (tool changes only)

  • "List the open issues in github/issues and tell me which ones are P1." — agent can now answer from the response without follow-up tool calls.
  • "What's the priority breakdown of open issues in github/issues?"

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered
    • first: 25 caps the per-issue field array at the same limit the dotcom monolith enforces (ORGANIZATION_ISSUE_FIELDS_LIMIT). No new auth surface — the values are scoped to the same repo permission the existing query already requires.

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

Lint & tests

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

Docs

  • Not needed
    • Schema is auto-generated from tool definitions; no README changes required for an additive response field.
  • Updated (README / docs / examples)

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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the list_issues tool’s issue output (MinimalIssue) to include GitHub Issues 2.0 custom issue field values (e.g., Priority/Impact) by selecting issueFieldValues(first: 25) in the GraphQL query and flattening the union results into a minimal {field, value} shape.

Changes:

  • Add field_values (array of {field, value, values}) to MinimalIssue and populate it when converting GraphQL fragments.
  • Introduce GraphQL fragment structs (IssueFieldRef, IssueFieldValueFragment) to read field names/values across the union types.
  • Update list_issues tests to include issueFieldValues in mocked responses and expected query strings.
Show a summary per file
File Description
pkg/github/minimal_types.go Adds MinimalIssue.FieldValues and conversion logic to flatten custom field values into the minimal response shape.
pkg/github/issues.go Extends the IssueFragment GraphQL selection with issueFieldValues(first: 25) and adds supporting fragment types for union decoding.
pkg/github/issues_test.go Updates mocked GraphQL responses/expected queries and asserts field_values flattening for list_issues.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1

Comment thread pkg/github/minimal_types.go
@kelsey-myers kelsey-myers force-pushed the kelsey/list-issues-field-values branch from 86654e4 to 0fccfb0 Compare May 13, 2026 11:07
@kelsey-myers kelsey-myers marked this pull request as ready for review May 13, 2026 11:10
@kelsey-myers kelsey-myers requested a review from a team as a code owner May 13, 2026 11:10
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