| 1726 | } |
| 1727 | |
| 1728 | func PullRequestReviewWrite(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 1729 | schema := &jsonschema.Schema{ |
| 1730 | Type: "object", |
| 1731 | Properties: map[string]*jsonschema.Schema{ |
| 1732 | // Either we need the PR GQL Id directly, or we need owner, repo and PR number to look it up. |
| 1733 | // Since our other Pull Request tools are working with the REST Client, will handle the lookup |
| 1734 | // internally for now. |
| 1735 | "method": { |
| 1736 | Type: "string", |
| 1737 | Description: `The write operation to perform on pull request review.`, |
| 1738 | Enum: []any{"create", "submit_pending", "delete_pending", "resolve_thread", "unresolve_thread"}, |
| 1739 | }, |
| 1740 | "owner": { |
| 1741 | Type: "string", |
| 1742 | Description: "Repository owner", |
| 1743 | }, |
| 1744 | "repo": { |
| 1745 | Type: "string", |
| 1746 | Description: "Repository name", |
| 1747 | }, |
| 1748 | "pullNumber": { |
| 1749 | Type: "number", |
| 1750 | Description: "Pull request number", |
| 1751 | }, |
| 1752 | "body": { |
| 1753 | Type: "string", |
| 1754 | Description: "Review comment text", |
| 1755 | }, |
| 1756 | "event": { |
| 1757 | Type: "string", |
| 1758 | Description: "Review action to perform.", |
| 1759 | Enum: []any{"APPROVE", "REQUEST_CHANGES", "COMMENT"}, |
| 1760 | }, |
| 1761 | "commitID": { |
| 1762 | Type: "string", |
| 1763 | Description: "SHA of commit to review", |
| 1764 | }, |
| 1765 | "threadId": { |
| 1766 | Type: "string", |
| 1767 | Description: "The node ID of the review thread (e.g., PRRT_kwDOxxx). Required for resolve_thread and unresolve_thread methods. Get thread IDs from pull_request_read with method get_review_comments.", |
| 1768 | }, |
| 1769 | }, |
| 1770 | Required: []string{"method", "owner", "repo", "pullNumber"}, |
| 1771 | } |
| 1772 | |
| 1773 | st := NewTool( |
| 1774 | ToolsetMetadataPullRequests, |
| 1775 | mcp.Tool{ |
| 1776 | Name: "pull_request_review_write", |
| 1777 | Description: t("TOOL_PULL_REQUEST_REVIEW_WRITE_DESCRIPTION", `Create and/or submit, delete review of a pull request. |
| 1778 | |
| 1779 | Available methods: |
| 1780 | - create: Create a new review of a pull request. If "event" parameter is provided, the review is submitted. If "event" is omitted, a pending review is created. |
| 1781 | - submit_pending: Submit an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request. The "body" and "event" parameters are used when submitting the review. |
| 1782 | - delete_pending: Delete an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request. |
| 1783 | - resolve_thread: Resolve a review thread. Requires only "threadId" parameter with the thread's node ID (e.g., PRRT_kwDOxxx). The owner, repo, and pullNumber parameters are not used for this method. Resolving an already-resolved thread is a no-op. |
| 1784 | - unresolve_thread: Unresolve a previously resolved review thread. Requires only "threadId" parameter. The owner, repo, and pullNumber parameters are not used for this method. Unresolving an already-unresolved thread is a no-op. |
| 1785 | `), |