Skip to content

Add support for issue fields values to issues.read and issues.write#2551

Open
kelsey-myers wants to merge 6 commits into
github:mainfrom
kelsey-myers:kelsey/issue-fields-clean
Open

Add support for issue fields values to issues.read and issues.write#2551
kelsey-myers wants to merge 6 commits into
github:mainfrom
kelsey-myers:kelsey/issue-fields-clean

Conversation

@kelsey-myers
Copy link
Copy Markdown
Contributor

Summary

This PR is passing issue field values to the issue write & read tools, which now (after #2452) support this.

Why

What changed

  • the go-gothub lib was updated to pass issue field value sto rest api
  • the repo upgraded to use v0.87 of go-github
  • we're now using new params for IssueFieldValues

MCP impact

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

Prompts tested (tool changes only)

  • added tests to make sure that passing fields works, as well as retrieving them

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)

@kelsey-myers
Copy link
Copy Markdown
Contributor Author

Tools tested on this branch

list_issue_fields

Inputs:

param type required notes
owner string yes repo owner or org login
repo string no if omitted, returns org-level fields

Output: array of issue field definitions

[
  {
    "id": "IFSS_1",
    "full_database_id": 99,
    "name": "Priority",
    "data_type": "SINGLE_SELECT",
    "visibility": "ALL",
    "options": [
      { "id": "OPT_1", "name": "High", "color": "red" },
      { "id": "OPT_2", "name": "Low", "color": "blue" }
    ]
  },
  {
    "id": "IFT_2",
    "full_database_id": 42,
    "name": "DRI",
    "data_type": "TEXT",
    "visibility": "ORG_ONLY"
  }
]

issue_write (create / update)

New input: issue_fields — array of field values to set on the issue. Each item requires field_name and either value or field_option_name (not both).

{
  "issue_fields": [
    { "field_name": "Priority", "field_option_name": "High" },
    { "field_name": "DRI", "value": "monalisa" },
    { "field_name": "Due Date", "value": "2026-06-01" }
  ]
}
  • Use field_option_name for SINGLE_SELECT fields — the server validates the option exists before calling the API
  • Use value for TEXT, NUMBER, and DATE fields

Output: unchanged — { "id": "...", "url": "..." }


issue_read (method: get)

Inputs: unchanged

Output: the response now includes a field_values array alongside the standard issue fields:

{
  "number": 123,
  "title": "...",
  "field_values": [
    { "field_name": "Priority", "value": "High" },
    { "field_name": "DRI", "value": "monalisa" }
  ]
}

The raw issue_field_values from the REST response is replaced with this normalised GraphQL-sourced field_values for consistency with list_issues and search_issues.

iulia-b and others added 3 commits May 26, 2026 09:44
…abaseId

- Expose fullDatabaseId (BigInt) in list_issue_fields
- Add issue_fields parameter to issue_write for setting field values
- Support single-select fields via field_option_name resolution
- Add REST API field value extraction in get_issue responses
- Update minimal types with IssueFieldValue for REST responses

Co-authored-by: Copilot <[email protected]>
@kelsey-myers kelsey-myers force-pushed the kelsey/issue-fields-clean branch from 70e8866 to 7b1b06c Compare May 26, 2026 16:44
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 issues tool surface to support reading and writing GitHub Issues 2.0 custom field values, aligning issue_read/issue_write behavior with the newer REST/GraphQL capabilities introduced alongside the go-github upgrade.

Changes:

  • Added issue_fields input to issue_write, including name-based resolution of field IDs and (for single-select) option validation.
  • Expanded issue_read output handling to include REST issue_field_values, and added best-effort GraphQL enrichment to normalize to field_values where possible.
  • Updated minimal/DTO types and unit tests to cover issue field value parsing and write request shaping.
Show a summary per file
File Description
README.md Documents the new issue_fields input for issue_write.
pkg/github/minimal_types.go Adds REST-backed minimal issue field value types and separates REST issue_field_values from GraphQL-normalized field_values.
pkg/github/issues.go Implements parsing + GraphQL metadata resolution for issue_fields, wires field values into create/update, and adjusts search/get enrichment paths.
pkg/github/issues_test.go Adds/updates tests for get/write behavior involving issue field values.
pkg/github/issue_fields.go Fetches/stores GraphQL fullDatabaseId for issue fields and adds parsing helper.
pkg/github/issue_fields_test.go Updates expectations to include fullDatabaseId/DatabaseID.
pkg/github/toolsnaps/issue_write.snap Updates tool schema snapshot to include issue_fields.
docs/insiders-features.md Reflects the issue_fields parameter in generated docs.
docs/feature-flags.md Reflects the issue_fields parameter in generated docs.

Copilot's findings

Comments suppressed due to low confidence (1)

pkg/github/issues.go:1599

  • searchIssuesHandler now always performs GraphQL field_values enrichment whenever there are results, and returns an error if GraphQL is unavailable or the query fails. This looks like a regression of the documented behavior of FeatureFlagIssueFields (which is meant to gate search_issues field_values enrichment); please restore the feature-flag check so search_issues works without GraphQL issue fields features enabled.
	var fieldValuesByID map[string][]MinimalFieldValue
	if len(result.Issues) > 0 {
		gqlClient, err := deps.GetGQLClient(ctx)
		if err != nil {
			return utils.NewToolResultErrorFromErr(errorPrefix+": failed to get GitHub GraphQL client", err), nil
		}
		fieldValuesByID, err = fetchIssueFieldValuesByNodeID(ctx, gqlClient, result.Issues)
		if err != nil {
			return ghErrors.NewGitHubGraphQLErrorResponse(ctx, errorPrefix+": failed to fetch issue field values", err), nil
		}
	}
  • Files reviewed: 9/9 changed files
  • Comments generated: 2

Comment thread pkg/github/issues.go Outdated
Comment thread pkg/github/issues.go
@kelsey-myers kelsey-myers marked this pull request as ready for review May 26, 2026 16:58
@kelsey-myers kelsey-myers requested a review from a team as a code owner May 26, 2026 16:58
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