MCPcopy Index your code
hub / github.com/github/github-mcp-server / AddSubIssue

Function AddSubIssue

pkg/github/issues.go:1416–1447  ·  view source on GitHub ↗
(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int, replaceParent bool)

Source from the content-addressed store, hash-verified

1414}
1415
1416func AddSubIssue(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int, replaceParent bool) (*mcp.CallToolResult, error) {
1417 subIssueRequest := github.SubIssueRequest{
1418 SubIssueID: int64(subIssueID),
1419 ReplaceParent: github.Ptr(replaceParent),
1420 }
1421
1422 subIssue, resp, err := client.SubIssue.Add(ctx, owner, repo, int64(issueNumber), subIssueRequest)
1423 if err != nil {
1424 return ghErrors.NewGitHubAPIErrorResponse(ctx,
1425 "failed to add sub-issue",
1426 resp,
1427 err,
1428 ), nil
1429 }
1430
1431 defer func() { _ = resp.Body.Close() }()
1432
1433 if resp.StatusCode != http.StatusCreated {
1434 body, err := io.ReadAll(resp.Body)
1435 if err != nil {
1436 return nil, fmt.Errorf("failed to read response body: %w", err)
1437 }
1438 return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to add sub-issue", resp, body), nil
1439 }
1440
1441 r, err := json.Marshal(subIssue)
1442 if err != nil {
1443 return nil, fmt.Errorf("failed to marshal response: %w", err)
1444 }
1445
1446 return utils.NewToolResultText(string(r)), nil
1447}
1448
1449func RemoveSubIssue(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int) (*mcp.CallToolResult, error) {
1450 subIssueRequest := github.SubIssueRequest{

Callers 2

SubIssueWriteFunction · 0.85
GranularAddSubIssueFunction · 0.85

Calls 3

NewToolResultTextFunction · 0.92
AddMethod · 0.80
CloseMethod · 0.80

Tested by

no test coverage detected