Attach a sub-issue with the add_sub_issue tool
Goal: attach an existing child issue to an existing parent issue using GitHub’s native sub-issue relationship.
Prerequisites
Section titled “Prerequisites”- Both the parent and the child issue already exist.
- The parent has fewer than 100 existing sub-issues.
- Attaching the child would not place the resulting hierarchy at or past 8 nesting levels (the tool computes the parent’s current level by walking its own parent chain before deciding).
- The child may live in a different repository within the same
organization — pass
childOwner/childRepoif so.
-
Call
add_sub_issue:{"owner": "your-org","repo": "your-repo","parentNumber": 101,"childNumber": 102} -
If the child is in a different repo:
{"owner": "your-org","repo": "parent-repo","parentNumber": 101,"childOwner": "your-org","childRepo": "child-repo","childNumber": 7} -
On a concurrent re-parent (the child already has a different parent), the default
replaceParent: truelets the call succeed by reassigning it. PassreplaceParent: falseif you want it to fail instead when the child is already parented elsewhere.
Verify it worked
Section titled “Verify it worked”- Read the response:
{ parentNodeId, childNodeId, replacedParent }. - Reload the parent issue on GitHub — the native “Sub-issues” panel lists the child.
- Call
list_sub_issuesagainst the parent and confirm the child appears initems. - If the parent was already at the sub-issue or nesting limit, the call
fails before reaching GitHub with
{ error: "limit_exceeded", limit: "max_sub_issues_per_parent" | "max_nesting_levels", ... }.
See also: tool reference.