Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_list_pull_request_thread_comments

Retrieve and manage comments in a pull request thread within Azure DevOps repositories. Input repository ID, pull request ID, and thread ID to access, filter, and organize feedback efficiently.

Instructions

Retrieve a list of comments in a pull request thread.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullResponseNoReturn full comment JSON response instead of trimmed data.
projectNoProject ID or project name (optional)
pullRequestIdYesThe ID of the pull request for which to retrieve thread comments.
repositoryIdYesThe ID of the repository where the pull request is located.
skipNoThe number of comments to skip.
threadIdYesThe ID of the thread for which to retrieve comments.
topNoThe maximum number of comments to return.

Implementation Reference

  • The handler function that implements the core logic: fetches comments via Azure DevOps Git API's getComments method for the specified repository, pull request, and thread; applies sorting and pagination; optionally trims comments using the trimComments helper; returns JSON-formatted response.
    async ({ repositoryId, pullRequestId, threadId, project, top, skip, fullResponse }) => {
      const connection = await connectionProvider();
      const gitApi = await connection.getGitApi();
    
      // Get thread comments - GitApi uses getComments for retrieving comments from a specific thread
      const comments = await gitApi.getComments(repositoryId, pullRequestId, threadId, project);
    
      const paginatedComments = comments?.sort((a, b) => (a.id ?? 0) - (b.id ?? 0)).slice(skip, skip + top);
    
      if (fullResponse) {
        return {
          content: [{ type: "text", text: JSON.stringify(paginatedComments, null, 2) }],
        };
      }
    
      // Return trimmed comment data focusing on essential information
      const trimmedComments = trimComments(paginatedComments);
    
      return {
        content: [{ type: "text", text: JSON.stringify(trimmedComments, null, 2) }],
      };
  • Zod schema defining input parameters for the tool, including required repositoryId, pullRequestId, threadId, and optional pagination and project parameters.
    {
      repositoryId: z.string().describe("The ID of the repository where the pull request is located."),
      pullRequestId: z.number().describe("The ID of the pull request for which to retrieve thread comments."),
      threadId: z.number().describe("The ID of the thread for which to retrieve comments."),
      project: z.string().optional().describe("Project ID or project name (optional)"),
      top: z.number().default(100).describe("The maximum number of comments to return."),
      skip: z.number().default(0).describe("The number of comments to skip."),
      fullResponse: z.boolean().optional().default(false).describe("Return full comment JSON response instead of trimmed data."),
  • Registers the tool using McpServer.tool() method, referencing the tool name from REPO_TOOLS, providing description, input schema, and handler function.
    server.tool(
      REPO_TOOLS.list_pull_request_thread_comments,
      "Retrieve a list of comments in a pull request thread.",
      {
        repositoryId: z.string().describe("The ID of the repository where the pull request is located."),
        pullRequestId: z.number().describe("The ID of the pull request for which to retrieve thread comments."),
        threadId: z.number().describe("The ID of the thread for which to retrieve comments."),
        project: z.string().optional().describe("Project ID or project name (optional)"),
        top: z.number().default(100).describe("The maximum number of comments to return."),
        skip: z.number().default(0).describe("The number of comments to skip."),
        fullResponse: z.boolean().optional().default(false).describe("Return full comment JSON response instead of trimmed data."),
      },
      async ({ repositoryId, pullRequestId, threadId, project, top, skip, fullResponse }) => {
        const connection = await connectionProvider();
        const gitApi = await connection.getGitApi();
    
        // Get thread comments - GitApi uses getComments for retrieving comments from a specific thread
        const comments = await gitApi.getComments(repositoryId, pullRequestId, threadId, project);
    
        const paginatedComments = comments?.sort((a, b) => (a.id ?? 0) - (b.id ?? 0)).slice(skip, skip + top);
    
        if (fullResponse) {
          return {
            content: [{ type: "text", text: JSON.stringify(paginatedComments, null, 2) }],
          };
        }
    
        // Return trimmed comment data focusing on essential information
        const trimmedComments = trimComments(paginatedComments);
    
        return {
          content: [{ type: "text", text: JSON.stringify(trimmedComments, null, 2) }],
        };
      }
    );
  • Supporting helper function to filter out deleted comments and trim to essential properties (id, author, content, dates), used by the handler for non-full responses.
    function trimComments(comments: any[] | undefined | null) {
      return comments
        ?.filter((comment) => !comment.isDeleted) // Exclude deleted comments
        ?.map((comment) => ({
          id: comment.id,
          author: {
            displayName: comment.author?.displayName,
            uniqueName: comment.author?.uniqueName,
          },
          content: comment.content,
          publishedDate: comment.publishedDate,
          lastUpdatedDate: comment.lastUpdatedDate,
          lastContentUpdatedDate: comment.lastContentUpdatedDate,
        }));
  • Part of REPO_TOOLS constant: maps the internal identifier 'list_pull_request_thread_comments' to the public tool name 'repo_list_pull_request_thread_comments' used in registration.
    list_pull_request_thread_comments: "repo_list_pull_request_thread_comments",
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Retrieve' implies a read-only operation, the description doesn't mention authentication requirements, rate limits, pagination behavior (beyond what's implied by 'skip' and 'top' parameters), error conditions, or response format. For a tool with 7 parameters and no annotation coverage, this leaves significant behavioral aspects undocumented.

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, clear sentence that efficiently communicates the core functionality without unnecessary words. It's appropriately sized for a straightforward list operation and gets directly to the point. Every word earns its place in this concise formulation.

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

Completeness3/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 (7 parameters, 3 required) and the absence of both annotations and output schema, the description is minimally adequate but incomplete. It states what the tool does but lacks crucial context about authentication, error handling, response format, and relationships to sibling tools. The 100% schema coverage helps, but for a tool with no output schema, more behavioral context would be beneficial.

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%, with all parameters well-documented in the input schema. The description doesn't add any parameter-specific information beyond what's already in the schema (e.g., it doesn't explain relationships between parameters like 'repositoryId', 'pullRequestId', and 'threadId'). With complete schema coverage, the baseline score of 3 is appropriate as the description provides no additional parameter semantics.

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 ('Retrieve a list') and target resource ('comments in a pull request thread'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'repo_list_pull_request_threads' or 'wit_list_work_item_comments', but the specificity of 'pull request thread comments' provides adequate distinction. This is clear but lacks explicit sibling differentiation.

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. There are multiple sibling tools for listing comments (e.g., 'wit_list_work_item_comments') and pull request-related data, but no indication of when this specific tool is appropriate. The description is purely functional without contextual usage information.

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

Related 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/ennuiii/DevOpsMcpPAT'

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