Skip to content

Add list_issue_fields tool#2445

Draft
kelsey-myers wants to merge 12 commits into
github:mainfrom
kelsey-myers:mj/add-list-org-issue-fields
Draft

Add list_issue_fields tool#2445
kelsey-myers wants to merge 12 commits into
github:mainfrom
kelsey-myers:mj/add-list-org-issue-fields

Conversation

@kelsey-myers
Copy link
Copy Markdown
Contributor

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

Summary

Adds a list_issue_fields tool that returns field definitions (name, type, options) for a GitHub org or repo. Picks up where #2438 left off, with some direction changes since.

Why

Agents need to discover available custom fields before they can set field values on issues. Without this, they're guessing field names and types.

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

What changed

  • Added issue_fields.go with list_issue_fields tool — queries repository.issueFields or organization.issueFields via GraphQL depending on whether repo is passed
  • repo is optional: passing owner+repo returns fields inherited from the org; passing owner alone returns org-level fields directly
  • Scopes: repo or read:org (either suffices, matching list_issue_types approach)
  • Added WithGraphQLFeatures(ctx, "issue_fields") so the query hits the feature-flagged field on the monolith
  • Added tests for both paths, scope assertions, toolsnap
  • Updated README

MCP impact

  • New tool added

list_issue_fields — read-only tool returning field definitions (id, name, data_type, visibility, options for single_select). Requires repo or read:org scope.

Prompts tested

  • "List all issue fields for the github org"
  • "What custom fields are available for issues in the github/github-mcp-server repo?"

Security / limits

  • Auth / permissions considered

repo or read:org required. User-owned repos return [] (no error) — monolith returns null for non-org owners, which resolves to an empty list naturally.

Tool renaming

  • I am not renaming tools as part of this PR

Note: the original PR used list_org_issue_fields — renamed to list_issue_fields since it now covers both repo and org.

Lint & tests

  • Linted locally with lint
  • Tested locally with test

Docs

  • Updated (README / docs / examples)

@kelsey-myers kelsey-myers requested a review from a team as a code owner May 8, 2026 11:29
Copilot AI review requested due to automatic review settings May 8, 2026 11:29
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 read-only MCP tool to list organization-level issue field definitions (including single-select options) so agents can discover valid custom fields before creating/updating issues.

Changes:

  • Implemented list_org_issue_fields tool calling GET /orgs/{org}/issue-fields, with 404 returning an empty list.
  • Added unit tests covering success and common error scenarios.
  • Registered the tool, added a toolsnap, and updated README tool docs.
Show a summary per file
File Description
README.md Documents the new list_org_issue_fields tool and required scopes.
pkg/github/tools.go Registers the new tool in the issues toolset.
pkg/github/issue_fields.go Implements the tool and response types for org issue fields/options.
pkg/github/issue_fields_test.go Adds unit tests for the new tool behavior.
pkg/github/toolsnaps/list_org_issue_fields.snap Captures the tool schema snapshot for regression checking.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 2

Comment thread pkg/github/issue_fields.go Outdated
Comment thread pkg/github/issue_fields_test.go Outdated
@kelsey-myers kelsey-myers mentioned this pull request May 8, 2026
15 tasks
@kelsey-myers
Copy link
Copy Markdown
Contributor Author

kelsey-myers commented May 8, 2026

Returns:

[
 {
    "id": "IFSS_kgAD",
    "name": "Visibility",
    "description": "Who can view or is impacted by the issue.",
    "data_type": "SINGLE_SELECT",
    "visibility": "ORG_ONLY",
    "options": [
      {
        "id": "IFSSO_kgAJ",
        "name": "High",
        "color": "RED",
        "priority": 0
      },
      {
        "id": "IFSSO_kgAK",
        "name": "Medium",
        "color": "YELLOW",
        "priority": 0
      },
      {
        "id": "IFSSO_kgAL",
        "name": "Low",
        "color": "GREEN",
        "priority": 0
      }
    ]
  },
...
]

kerobbi
kerobbi previously approved these changes May 13, 2026
@kelsey-myers kelsey-myers marked this pull request as draft May 14, 2026 08:39
@kelsey-myers kelsey-myers changed the title Add list_org_issue_fields tool Add list_repo_issue_fields tool May 14, 2026
@kelsey-myers kelsey-myers changed the title Add list_repo_issue_fields tool WIP: Add list_repo_issue_fields tool May 14, 2026
@kelsey-myers kelsey-myers changed the title WIP: Add list_repo_issue_fields tool Add list_org_issue_fields tool May 14, 2026
@kelsey-myers kelsey-myers changed the title Add list_org_issue_fields tool Add list_issue_fields tool May 20, 2026
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.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 5

Comment thread pkg/github/issue_fields.go Outdated
Comment thread pkg/github/issue_fields.go
Comment thread README.md
Comment thread pkg/github/issue_fields.go
Comment thread pkg/github/issue_fields_test.go
@kelsey-myers
Copy link
Copy Markdown
Contributor Author

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.

5 participants