GranularResolveReviewThread creates a tool to resolve a review thread.
(t translations.TranslationHelperFunc)
| 672 | |
| 673 | // GranularResolveReviewThread creates a tool to resolve a review thread. |
| 674 | func GranularResolveReviewThread(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 675 | st := NewTool( |
| 676 | ToolsetMetadataPullRequests, |
| 677 | mcp.Tool{ |
| 678 | Name: "resolve_review_thread", |
| 679 | Description: t("TOOL_RESOLVE_REVIEW_THREAD_DESCRIPTION", "Resolve a review thread on a pull request. Resolving an already-resolved thread is a no-op."), |
| 680 | Annotations: &mcp.ToolAnnotations{ |
| 681 | Title: t("TOOL_RESOLVE_REVIEW_THREAD_USER_TITLE", "Resolve Review Thread"), |
| 682 | ReadOnlyHint: false, |
| 683 | DestructiveHint: jsonschema.Ptr(false), |
| 684 | OpenWorldHint: jsonschema.Ptr(true), |
| 685 | }, |
| 686 | InputSchema: &jsonschema.Schema{ |
| 687 | Type: "object", |
| 688 | Properties: map[string]*jsonschema.Schema{ |
| 689 | "threadID": { |
| 690 | Type: "string", |
| 691 | Description: "The node ID of the review thread to resolve (e.g., PRRT_kwDOxxx)", |
| 692 | }, |
| 693 | }, |
| 694 | Required: []string{"threadID"}, |
| 695 | }, |
| 696 | }, |
| 697 | []scopes.Scope{scopes.Repo}, |
| 698 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 699 | threadID, err := RequiredParam[string](args, "threadID") |
| 700 | if err != nil { |
| 701 | return utils.NewToolResultError(err.Error()), nil, nil |
| 702 | } |
| 703 | |
| 704 | gqlClient, err := deps.GetGQLClient(ctx) |
| 705 | if err != nil { |
| 706 | return utils.NewToolResultErrorFromErr("failed to get GitHub GraphQL client", err), nil, nil |
| 707 | } |
| 708 | |
| 709 | result, err := ResolveReviewThread(ctx, gqlClient, threadID, true) |
| 710 | return result, nil, err |
| 711 | }, |
| 712 | ) |
| 713 | st.FeatureFlagEnable = FeatureFlagPullRequestsGranular |
| 714 | return st |
| 715 | } |
| 716 | |
| 717 | // GranularUnresolveReviewThread creates a tool to unresolve a review thread. |
| 718 | func GranularUnresolveReviewThread(t translations.TranslationHelperFunc) inventory.ServerTool { |