Skip to content

Add list_org_issue_fields tool#2445

Open
kelsey-myers wants to merge 6 commits intogithub:mainfrom
kelsey-myers:mj/add-list-org-issue-fields
Open

Add list_org_issue_fields tool#2445
kelsey-myers wants to merge 6 commits intogithub:mainfrom
kelsey-myers:mj/add-list-org-issue-fields

Conversation

@kelsey-myers
Copy link
Copy Markdown

Summary

Add a new list_org_issue_fields MCP tool that retrieves issue field definitions for a GitHub organization, including field names, types, and single-select options.

Why

Enables AI agents to discover available custom issue fields for an organization, which is necessary for workflows that create or update issues with custom field values.
Fixes https://github.com/github/plan-track-agentic-toolkit/issues/38

Picks up where #2438 left off (originally authored by @michaeljacholke). Additional changes in this PR:

  • Dropped created_at/updated_at from IssueField and IssueSingleSelectFieldOption per feedback
  • Switched non-404 error path to ghErrors.NewGitHubAPIErrorResponse for consistency with other tools
  • Set expectError=true for forbidden/500 test cases to properly assert error behavior

What changed

  • Added issue_fields.go with ListOrgIssueFields tool implementation, calling GET /orgs/{org}/issue-fields
  • Added issue_fields_test.go with unit tests covering success, 404 (empty list), 403, 500, and missing parameter cases
  • Registered the tool in tools.go under the issues toolset
  • Added toolsnap list_org_issue_fields.snap
  • Updated README.md with tool documentation

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added
    list_org_issue_fields — a read-only tool that lists organization-level issue field definitions (text, number, date, single_select) and their options. Requires read:org scope.

Prompts tested (tool changes only)

  • "List all issue fields for the github org"
  • "What custom fields are available for issues in my organization?"

Security / limits

  • No security or limits impact
  • Auth / permissions considered
    Requires read:org OAuth scope. Returns empty list on 404 (org doesn't have issue fields enabled) rather than exposing error details.
  • Data exposure, filtering, or token/size limits considered

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)

@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
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
Author

Returns:

[
  {
    "id": 1,
    "node_id": "IFSS_kgAB",
    "name": "Priority",
    "description": "Indicates the urgency and business impact of the issue",
    "data_type": "single_select",
    "visibility": "organization_members_only",
    "options": [
      {
        "id": 1201,
        "name": "P0",
        "description": "Critical issue requiring immediate resolution to restore essential functionality",
        "color": "pink",
        "priority": 1
      },
      {
        "id": 1,
        "name": "P1",
        "description": "High impact to users or experience; workaround may exist but is difficult or unclear",
        "color": "red",
        "priority": 2
      },
      {
        "id": 2,
        "name": "P2",
        "description": "Resolution not needed immediately, but we should make time to resolve the issue",
        "color": "blue",
        "priority": 3
      },
      {
        "id": 3,
        "name": "P3",
        "description": "Slight performance degradation, likely not noticed or minimal impact to customers",
        "color": "green",
        "priority": 4
      },
      {
        "id": 4,
        "name": "P4",
        "description": "A very low priority issue that will not be addressed",
        "color": "gray",
        "priority": 5
      }
    ]
  },
...
]

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