Skip to main content
Glama
UtakataKyosui

PR Review MCP Server

list_review_threads

Retrieve GitHub pull request review threads to track and manage code review discussions, optionally filtering for unresolved comments.

Instructions

List review threads for a GitHub pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
repoYesRepository name
pull_numberYesPull request number
unresolved_onlyNoOnly return unresolved threads (default: true)

Implementation Reference

  • The handler function for the 'list_review_threads' MCP tool. It parses input arguments, fetches review threads using GitHubAPI, formats them into a structured JSON response including thread details and first comment info, and returns as TextContent.
    async def handle_list_review_threads(
        api: GitHubAPI, arguments: dict[str, Any]
    ) -> list[TextContent]:
        """Handle list_review_threads tool call."""
    
        owner = arguments["owner"]
        repo = arguments["repo"]
        pull_number = arguments["pull_number"]
        unresolved_only = arguments.get("unresolved_only", True)
    
        threads = api.list_review_threads(owner, repo, pull_number, unresolved_only)
    
        # Format output
        result = {
            "pull_request": f"{owner}/{repo}#{pull_number}",
            "thread_count": len(threads),
            "threads": [],
        }
    
        for thread in threads:
            comments = thread.get("comments", {}).get("nodes", [])
            first_comment = comments[0] if comments else {}
    
            thread_info = {
                "id": thread.get("id"),
                "is_resolved": thread.get("isResolved", False),
                "file": thread.get("path"),
                "line": thread.get("line"),
                "start_line": thread.get("startLine"),
                "diff_side": thread.get("diffSide"),
                "comment_count": len(comments),
                "first_comment": {
                    "author": first_comment.get("author", {}).get("login", "unknown"),
                    "body": first_comment.get("body", ""),
                    "created_at": first_comment.get("createdAt", ""),
                },
            }
            result["threads"].append(thread_info)
    
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • The input schema and metadata for the 'list_review_threads' tool, defining parameters: owner, repo, pull_number (required), and unresolved_only (optional boolean with default True).
        name="list_review_threads",
        description="List review threads for a GitHub pull request",
        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"},
                "unresolved_only": {
                    "type": "boolean",
                    "description": "Only return unresolved threads (default: true)",
                    "default": True,
                },
            },
            "required": ["owner", "repo", "pull_number"],
        },
    ),
  • Tool dispatch registration in the call_tool handler, routing 'list_review_threads' calls to the specific handle_list_review_threads function.
    if name == "list_review_threads":
        return await handle_list_review_threads(api, arguments)
  • Supporting GitHubAPI helper method that executes a GraphQL query to fetch review threads for a PR, including details like comments, and filters unresolved threads if specified.
    def list_review_threads(
        self, owner: str, repo: str, pull_number: int, unresolved_only: bool = True
    ) -> list[dict[str, Any]]:
        """
        List review threads for a pull request.
    
        Args:
            owner: Repository owner
            repo: Repository name
            pull_number: Pull request number
            unresolved_only: Only return unresolved threads
    
        Returns:
            List of review thread objects
        """
        query = """
        query GetReviewThreads($owner: String!, $repo: String!, $pullNumber: Int!) {
            repository(owner: $owner, name: $repo) {
                pullRequest(number: $pullNumber) {
                    reviewThreads(first: 100) {
                        nodes {
                            id
                            isResolved
                            path
                            line
                            startLine
                            diffSide
                            comments(first: 50) {
                                nodes {
                                    id
                                    author {
                                        login
                                    }
                                    body
                                    createdAt
                                }
                            }
                        }
                    }
                }
            }
        }
        """
    
        variables = {"owner": owner, "repo": repo, "pullNumber": pull_number}
    
        data = self.execute_graphql(query, variables)
    
        threads = (
            data.get("repository", {})
            .get("pullRequest", {})
            .get("reviewThreads", {})
            .get("nodes", [])
        )
    
        # Filter by resolution status if requested
        if unresolved_only:
            threads = [t for t in threads if not t.get("isResolved", False)]
    
        return threads
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a list operation, implying read-only behavior, but doesn't mention authentication requirements, rate limits, pagination, or what the output looks like. This is inadequate for a tool with potential complexity.

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, efficient sentence with zero waste. It's front-loaded with the core purpose and appropriately sized for a straightforward list operation.

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?

Given no annotations, no output schema, and 4 parameters, the description is incomplete. It doesn't explain return values, authentication needs, or behavioral constraints, leaving significant gaps for the agent to understand how to use this tool effectively.

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?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond implying the tool operates on GitHub pull requests, which is already clear from parameter names like 'owner' and 'repo'. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('List') and target resource ('review threads for a GitHub pull request'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'reply_and_resolve' or 'resolve_review_thread', which are related but distinct operations.

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. It doesn't mention sibling tools or contextual factors like when to list threads versus replying to or resolving them, leaving the agent without usage direction.

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