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

Function ResolveReviewThread

pkg/github/pullrequests.go:2053–2104  ·  view source on GitHub ↗

ResolveReviewThread resolves or unresolves a PR review thread using GraphQL mutations.

(ctx context.Context, client *githubv4.Client, threadID string, resolve bool)

Source from the content-addressed store, hash-verified

2051
2052// ResolveReviewThread resolves or unresolves a PR review thread using GraphQL mutations.
2053func ResolveReviewThread(ctx context.Context, client *githubv4.Client, threadID string, resolve bool) (*mcp.CallToolResult, error) {
2054 if threadID == "" {
2055 return utils.NewToolResultError("threadId is required for resolve_thread and unresolve_thread methods"), nil
2056 }
2057
2058 if resolve {
2059 var mutation struct {
2060 ResolveReviewThread struct {
2061 Thread struct {
2062 ID githubv4.ID
2063 IsResolved githubv4.Boolean
2064 }
2065 } `graphql:"resolveReviewThread(input: $input)"`
2066 }
2067
2068 input := githubv4.ResolveReviewThreadInput{
2069 ThreadID: githubv4.ID(threadID),
2070 }
2071
2072 if err := client.Mutate(ctx, &mutation, input, nil); err != nil {
2073 return ghErrors.NewGitHubGraphQLErrorResponse(ctx,
2074 "failed to resolve review thread",
2075 err,
2076 ), nil
2077 }
2078
2079 return utils.NewToolResultText("review thread resolved successfully"), nil
2080 }
2081
2082 // Unresolve
2083 var mutation struct {
2084 UnresolveReviewThread struct {
2085 Thread struct {
2086 ID githubv4.ID
2087 IsResolved githubv4.Boolean
2088 }
2089 } `graphql:"unresolveReviewThread(input: $input)"`
2090 }
2091
2092 input := githubv4.UnresolveReviewThreadInput{
2093 ThreadID: githubv4.ID(threadID),
2094 }
2095
2096 if err := client.Mutate(ctx, &mutation, input, nil); err != nil {
2097 return ghErrors.NewGitHubGraphQLErrorResponse(ctx,
2098 "failed to unresolve review thread",
2099 err,
2100 ), nil
2101 }
2102
2103 return utils.NewToolResultText("review thread unresolved successfully"), nil
2104}
2105
2106// AddCommentToPendingReviewParams contains the parameters for adding a comment to a pending review.
2107type AddCommentToPendingReviewParams struct {

Callers 3

PullRequestReviewWriteFunction · 0.85

Calls 2

NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92

Tested by

no test coverage detected