Skip to content

Add get_parent method to issue_read#2726

Merged
SamMorrowDrums merged 2 commits into
mainfrom
zwick/issue-dependencies-mcp
Jun 23, 2026
Merged

Add get_parent method to issue_read#2726
SamMorrowDrums merged 2 commits into
mainfrom
zwick/issue-dependencies-mcp

Conversation

@zwick

@zwick zwick commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a get_parent method to the existing issue_read tool that reads an issue's parent — the upward counterpart to the existing get_sub_issues (children).

Why

issue_read could read an issue's children (get_sub_issues) but had no way to read its parent, even though the GitHub API exposes it. This fills that gap with a small, always-on method on a default tool.

Refs #2391, #950

What changed

  • issue_read → new get_parent method. Reads the GraphQL Issue.parent field and returns a null parent when the issue isn't a sub-issue.
  • Kept always-on (not feature-gated), mirroring get_sub_issues. The schema cost is one enum value plus a couple of doc lines.

MCP impact

  • Tool schema or behavior changed — issue_read gains a get_parent method; existing methods are unchanged.

Prompts tested (tool changes only)

Security / limits

  • Auth / permissions considered — read-only; requires repo scope like the rest of issue_read.

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 regenerated for the new issue_read method)

Split out from the original combined PR. The flag-gated issue dependency tools (issue_dependency_read / issue_dependency_write) now live in #2751.

Copilot AI review requested due to automatic review settings June 17, 2026 20:31
@zwick zwick requested a review from a team as a code owner June 17, 2026 20:31

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

Adds new feature-flagged MCP tools to read and modify GitHub Issue dependency relationships (blocked-by / blocking) using GraphQL connections and the addBlockedBy / removeBlockedBy mutations, filling a gap not covered by existing issue relationship tools.

Changes:

  • Introduces issue_dependency_read (GraphQL Issue.blockedBy / Issue.blocking) with cursor pagination.
  • Introduces issue_dependency_write (GraphQL addBlockedBy / removeBlockedBy) resolving issue numbers to node IDs in a single aliased query.
  • Adds the issue_dependencies feature flag, tests, toolsnap snapshots, and regenerated docs sections.
Show a summary per file
File Description
pkg/github/tools.go Registers the new issue dependency tools in the overall tool inventory (feature-flag gated).
pkg/github/issue_dependencies.go Implements read/write tools and supporting GraphQL query/mutation helpers.
pkg/github/issue_dependencies_test.go Adds schema snapshot validation and behavior tests for the new tools.
pkg/github/feature_flags.go Introduces the issue_dependencies flag and wires it into feature-flag sets.
pkg/github/toolsnaps/issue_dependency_read_ff_issue_dependencies.snap Adds the flag-gated schema snapshot for the read tool.
pkg/github/toolsnaps/issue_dependency_write_ff_issue_dependencies.snap Adds the flag-gated schema snapshot for the write tool.
docs/insiders-features.md Documents the new issue_dependencies flag/tools in insiders features (generated section).
docs/feature-flags.md Documents the new issue_dependencies flag/tools in feature flags (generated section).

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 1
Comment thread pkg/github/feature_flags.go
@zwick zwick marked this pull request as draft June 17, 2026 20:39
@zwick zwick self-assigned this Jun 17, 2026
@zwick zwick changed the title Add issue dependency read/write MCP tools Jun 17, 2026
@zwick zwick marked this pull request as ready for review June 18, 2026 19:43
Add an upward parent read to issue_read, the counterpart to the existing
downward get_sub_issues. Uses the GraphQL Issue.parent field and returns a
null parent when the issue is not a sub-issue. Kept always-on (not feature
gated) to mirror get_sub_issues; the dependency tools remain flag-gated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@zwick zwick force-pushed the zwick/issue-dependencies-mcp branch from 409844e to 004248c Compare June 22, 2026 16:11
@zwick zwick changed the title Add issue dependency tools and issue_read get_parent Jun 22, 2026
@zwick zwick marked this pull request as draft June 22, 2026 16:13
@zwick zwick marked this pull request as ready for review June 22, 2026 17:27

@SamMorrowDrums SamMorrowDrums left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zwick I still think we might want to follow up with has_parent or has_children potentially, but merging.

@SamMorrowDrums SamMorrowDrums merged commit 9430064 into main Jun 23, 2026
19 checks passed
@SamMorrowDrums SamMorrowDrums deleted the zwick/issue-dependencies-mcp branch June 23, 2026 12:34
@roberjaime080-boop

Copy link
Copy Markdown

heavy horse

zwick added a commit that referenced this pull request Jun 30, 2026
The default issue_read `get` payload surfaced no hierarchy data, forcing
agents to drop to raw REST (parent_issue_url) or scan sibling sub_issues
to discover relationships. Enrich `get` with a layered, zero-extra-round-trip
relationship signal derived from a single combined GraphQL query:

- has_parent / has_children: cheap, always-emitted routing booleans
  (addresses Sam Morrow's #2726 review note).
- parent: compact ref (number/title/state/url/repository) mirroring the
  existing get_parent payload keys; omitted when there is no parent.
- sub_issues_summary: native subIssuesSummary counts (total/completed/
  percent_completed); omitted when there are no sub-issues.

The single-issue field-values GraphQL call in GetIssue is replaced by one
combined query (fetchIssueReadEnrichment) returning field values + parent +
subIssuesSummary, so `get` adds no round-trips. Enrichment is best-effort:
a query failure still returns the base issue and never fails `get`. Parent
titles are sanitized (parent may be cross-repo) and redacted under lockdown
mode unless the parent content can be verified as safe; numeric/structural
fields and counts stay intact. get_parent / sub_issue_write behavior is
unchanged; tool descriptions clarify hierarchy is read here but written via
sub_issue_write (no writable parent field).

Refs github/planning-tracking#3306

Co-authored-by: Copilot <223556219+Copilot@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

4 participants