Skip to content

Add granular tool to set issue field values#2338

Merged
SamMorrowDrums merged 3 commits intomainfrom
add-set-issue-fields-tool
Apr 16, 2026
Merged

Add granular tool to set issue field values#2338
SamMorrowDrums merged 3 commits intomainfrom
add-set-issue-fields-tool

Conversation

@mattdholloway
Copy link
Copy Markdown
Contributor

@mattdholloway mattdholloway commented Apr 16, 2026

Summary

This pull request adds a new granular tool for setting custom issue field values on GitHub issues via GraphQL. The tool supports updating, creating, and deleting organization-level custom fields (text, number, date, or single select) for issues. It includes robust input validation, schema definition, and comprehensive tests to ensure correct behavior and error handling.

Why

Closes https://github.com/github/copilot-mcp-core/issues/1544

What changed

New Feature: Set Issue Fields Tool

  • Implements a new set_issue_fields tool that allows setting, updating, or deleting organization-level custom fields (text, number, date, or single select) on GitHub issues via GraphQL. The tool validates input, constructs the appropriate mutation, and returns minimal response data.

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)

@mattdholloway mattdholloway requested a review from a team as a code owner April 16, 2026 12:44
Copilot AI review requested due to automatic review settings April 16, 2026 12: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

Adds a new granular Issues tool for setting organization-level custom issue field values via GitHub’s GraphQL API.

Changes:

  • Registers a new granular tool (set_issue_fields) in the global tool inventory.
  • Implements the tool in issues_granular.go, including GraphQL mutation input modeling and request parsing.
  • Adds tool snapshot coverage and unit tests for the new tool.
Show a summary per file
File Description
pkg/github/tools.go Registers GranularSetIssueFields in AllTools.
pkg/github/issues_granular.go Implements the set_issue_fields tool, schema, argument parsing, and GraphQL mutation call.
pkg/github/granular_tools_test.go Adds tool snap registration + unit tests for set_issue_fields.
pkg/github/toolsnaps/set_issue_fields.snap Introduces the tool schema snapshot for set_issue_fields.

Copilot's findings

Comments suppressed due to low confidence (1)

pkg/github/issues_granular.go:797

  • The GraphQL mutation response struct includes IssueFieldValues with a fragment tagged on the nested Field property, and the result isn’t used anywhere. This adds query complexity and risks schema/selection-set mismatches (it’s also hard-coded to IssueFieldDateValue even though the tool supports multiple field types). Consider removing IssueFieldValues from the mutation selection entirely, or model/select it correctly for all supported value types if you actually need it.
			var mutation struct {
				SetIssueFieldValue struct {
					Issue struct {
						ID     githubv4.ID
						Number githubv4.Int
						URL    githubv4.String
					}
					IssueFieldValues []struct {
						Field struct {
							Name string
						} `graphql:"... on IssueFieldDateValue"`
					}
				} `graphql:"setIssueFieldValue(input: $input)"`
  • Files reviewed: 4/4 changed files
  • Comments generated: 3

Comment thread pkg/github/issues_granular.go
Comment thread pkg/github/issues_granular.go Outdated
Comment thread pkg/github/granular_tools_test.go
* Initial plan

* Enforce exactly one value key per field in set_issue_fields and add tests

Address review feedback:
- Change validation to count value keys and reject when multiple are
  provided (e.g., text_value + number_value, or text_value + delete).
- Add unit tests for multiple value keys and value + delete scenarios.
- Run generate-docs (no doc changes needed; README was already current).

Agent-Logs-Url: https://github.com/github/github-mcp-server/sessions/7e89edb3-5315-42dd-bfa1-6c962f1ba137

Co-authored-by: mattdholloway <918573+mattdholloway@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mattdholloway <918573+mattdholloway@users.noreply.github.com>
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.

4 participants