Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

get-pull-request-comments

Retrieve review comments from a GitHub pull request to analyze feedback and track code review discussions.

Instructions

Get the review comments on a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
pull_numberYesPull request number
repoYesRepository name

Implementation Reference

  • The core handler function that validates input using Zod schema, calls the GitHub API (Octokit) to list review comments on a pull request, maps the response, and handles errors.
    export async function getPullRequestComments(args: unknown): Promise<any> {
      const { owner, repo, pull_number } = GetPullRequestCommentsSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().pulls.listReviewComments({
          owner,
          repo,
          pull_number,
        });
    
        return data.map((comment) => ({
          id: comment.id,
          user: comment.user ? {
            login: comment.user.login,
            id: comment.user.id,
          } : null,
          body: comment.body,
          created_at: comment.created_at,
          updated_at: comment.updated_at,
          path: comment.path,
          position: comment.position,
          commit_id: comment.commit_id,
          url: comment.html_url,
        }));
      }, 'Failed to get pull request comments');
    }
  • Zod schema for input validation: requires owner, repo (from OwnerRepoSchema), and pull_number.
    export const GetPullRequestCommentsSchema = OwnerRepoSchema.extend({
      pull_number: z.number().int().positive(),
    });
  • src/server.ts:977-999 (registration)
    Tool registration in the MCP server's listTools response, including name, description, and JSON schema matching the Zod schema.
    {
      name: 'get-pull-request-comments',
      description: 'Get the review comments on a pull request',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
            description: 'Repository owner (username or organization)',
          },
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          pull_number: {
            type: 'number',
            description: 'Pull request number',
          },
        },
        required: ['owner', 'repo', 'pull_number'],
        additionalProperties: false,
      },
    },
  • Switch case in the callTool handler that dispatches execution to the getPullRequestComments function.
    case 'get-pull-request-comments':
      result = await getPullRequestComments(parsedArgs);
      break;
  • Import of the input schema validator used in the handler.
    GetPullRequestCommentsSchema,
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 a read operation ('Get'), implying it's likely safe and non-destructive, but doesn't confirm this or detail other traits like rate limits, authentication needs, pagination, or the format of returned comments. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 that directly states the tool's function without any fluff or redundancy. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place, achieving optimal conciseness.

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 the tool's moderate complexity (fetching data with three parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the return values look like (e.g., comment structure, pagination), behavioral constraints, or error conditions. For a read operation with no structured output documentation, more context is needed to guide the agent 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?

The input schema has 100% description coverage, clearly documenting all three required parameters (owner, repo, pull_number). The description adds no additional parameter semantics beyond implying the tool fetches comments for a specific pull request, which is already evident from the schema. This meets the baseline score when schema coverage is high.

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 ('Get') and resource ('review comments on a pull request'), making the purpose immediately understandable. It distinguishes from siblings like 'get-pull-request' or 'get-pull-request-reviews' by specifying comments rather than general PR data or reviews. However, it doesn't explicitly contrast with these siblings in the text, preventing a perfect score.

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 related tools like 'get-pull-request-reviews' for review-level comments or 'add-issue-comment' for adding comments, nor does it specify prerequisites such as needing an existing pull request. This leaves the agent to infer usage from context alone.

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/piyushgIITian/github-enterprice-mcp'

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