Skip to main content
Glama
UtakataKyosui

PR Review MCP Server

reply_to_review_thread

Add a reply to a GitHub pull request review thread to address comments, provide clarification, or continue discussion on code changes.

Instructions

Add a reply to a review thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
repoYesRepository name
pull_numberYesPull request number
thread_idYesReview thread ID (from list_review_threads)
bodyYesReply content (Markdown supported)

Implementation Reference

  • Main handler function that extracts input arguments, retrieves the PR ID, adds a reply to the review thread using the GitHub API, formats the result as JSON, and returns it as TextContent.
    async def handle_reply_to_review_thread(
        api: GitHubAPI, arguments: dict[str, Any]
    ) -> list[TextContent]:
        """Handle reply_to_review_thread tool call."""
    
        owner = arguments["owner"]
        repo = arguments["repo"]
        pull_number = arguments["pull_number"]
        thread_id = arguments["thread_id"]
        body = arguments["body"]
    
        # Get PR ID
        pr_id = api.get_pr_id(owner, repo, pull_number)
    
        # Add reply
        comment = api.add_thread_reply(pr_id, thread_id, body)
    
        result = {
            "success": True,
            "comment": {
                "id": comment.get("id"),
                "author": comment.get("author", {}).get("login"),
                "body": comment.get("body"),
                "created_at": comment.get("createdAt"),
            },
        }
    
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Input schema definition for the tool, specifying required parameters: owner, repo, pull_number, thread_id, and body.
    Tool(
        name="reply_to_review_thread",
        description="Add a reply to a review thread",
        inputSchema={
            "type": "object",
            "properties": {
                "owner": {
                    "type": "string",
                    "description": "Repository owner (username or organization)",
                },
                "repo": {"type": "string", "description": "Repository name"},
                "pull_number": {"type": "integer", "description": "Pull request number"},
                "thread_id": {
                    "type": "string",
                    "description": "Review thread ID (from list_review_threads)",
                },
                "body": {
                    "type": "string",
                    "description": "Reply content (Markdown supported)",
                },
            },
            "required": ["owner", "repo", "pull_number", "thread_id", "body"],
        },
    ),
  • Tool dispatch logic in the call_tool handler that routes calls to the specific reply_to_review_thread handler.
    elif name == "reply_to_review_thread":
        return await handle_reply_to_review_thread(api, arguments)
  • Top-level registration of all tools including reply_to_review_thread by calling register_tools on the MCP server.
    # Register tools
    register_tools(server)
  • Supporting GitHub API helper that executes the GraphQL mutation to add a reply to a specific review thread.
    def add_thread_reply(self, pull_request_id: str, thread_id: str, body: str) -> dict[str, Any]:
        """
        Add a reply to a review thread.
    
        Args:
            pull_request_id: Pull request node ID
            thread_id: Review thread node ID
            body: Reply content
    
        Returns:
            Created comment object
        """
        query = """
        mutation AddReply($pullRequestId: ID!, $threadId: ID!, $body: String!) {
            addPullRequestReviewThreadReply(input: {
                pullRequestId: $pullRequestId
                pullRequestReviewThreadId: $threadId
                body: $body
            }) {
                comment {
                    id
                    body
                    createdAt
                    author {
                        login
                    }
                }
            }
        }
        """
    
        variables = {"pullRequestId": pull_request_id, "threadId": thread_id, "body": body}
    
        data = self.execute_graphql(query, variables)
        comment = data.get("addPullRequestReviewThreadReply", {}).get("comment", {})
    
        if not comment:
            raise GitHubAPIError("Failed to create comment")
    
        return comment
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool adds a reply, implying a write/mutation operation, but doesn't clarify permissions needed, whether it's idempotent, or what happens on success/failure. The description lacks crucial behavioral context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence that directly states the tool's purpose without unnecessary words. It's perfectly front-loaded and wastes no space, making it highly efficient for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 5 parameters and no annotations or output schema, the description is insufficient. It doesn't explain what happens after the reply is added, how errors are handled, or how this differs from sibling tools. The minimal description leaves too many contextual gaps for effective tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter information beyond what's already documented in the schema (which has 100% coverage). It doesn't explain relationships between parameters (e.g., that 'thread_id' comes from 'list_review_threads') or provide usage examples. With complete schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add a reply') and the target resource ('to a review thread'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'reply_and_resolve', which suggests a similar action with additional functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'reply_and_resolve' or 'resolve_review_thread'. It also doesn't mention prerequisites such as needing an existing review thread from 'list_review_threads', which is only hinted at in the schema for 'thread_id'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/UtakataKyosui/PR-Review-Resolve-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server