Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_list_pull_request_threads

Retrieve and manage comment threads for specific pull requests in Azure DevOps repositories. Streamline review processes by accessing detailed thread data based on repository ID, pull request ID, and optional filters.

Instructions

Retrieve a list of comment threads for a pull request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseIterationNoThe base iteration ID for which to retrieve threads. Optional, defaults to the latest base iteration.
fullResponseNoReturn full thread JSON response instead of trimmed data.
iterationNoThe iteration ID for which to retrieve threads. Optional, defaults to the latest iteration.
projectNoProject ID or project name (optional)
pullRequestIdYesThe ID of the pull request for which to retrieve threads.
repositoryIdYesThe ID of the repository where the pull request is located.
skipNoThe number of threads to skip.
topNoThe maximum number of threads to return.

Implementation Reference

  • The main handler function that executes the logic for listing pull request threads using Azure DevOps Git API, including pagination and optional trimming of comments.
    async ({ repositoryId, pullRequestId, project, iteration, baseIteration, top, skip, fullResponse }) => {
      const connection = await connectionProvider();
      const gitApi = await connection.getGitApi();
    
      const threads = await gitApi.getThreads(repositoryId, pullRequestId, project, iteration, baseIteration);
    
      const paginatedThreads = threads?.sort((a, b) => (a.id ?? 0) - (b.id ?? 0)).slice(skip, skip + top);
    
      if (fullResponse) {
        return {
          content: [{ type: "text", text: JSON.stringify(paginatedThreads, null, 2) }],
        };
      }
    
      // Return trimmed thread data focusing on essential information
      const trimmedThreads = paginatedThreads?.map((thread) => ({
        id: thread.id,
        publishedDate: thread.publishedDate,
        lastUpdatedDate: thread.lastUpdatedDate,
        status: thread.status,
        comments: trimComments(thread.comments),
      }));
    
      return {
        content: [{ type: "text", text: JSON.stringify(trimmedThreads, null, 2) }],
      };
    }
  • Input schema using Zod validators for the tool's 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 threads."),
      project: z.string().optional().describe("Project ID or project name (optional)"),
      iteration: z.number().optional().describe("The iteration ID for which to retrieve threads. Optional, defaults to the latest iteration."),
      baseIteration: z.number().optional().describe("The base iteration ID for which to retrieve threads. Optional, defaults to the latest base iteration."),
      top: z.number().default(100).describe("The maximum number of threads to return."),
      skip: z.number().default(0).describe("The number of threads to skip."),
      fullResponse: z.boolean().optional().default(false).describe("Return full thread JSON response instead of trimmed data."),
    },
  • Registration of the tool using McpServer.tool() with name from REPO_TOOLS.list_pull_request_threads, description, input schema, and handler.
      REPO_TOOLS.list_pull_request_threads,
      "Retrieve a list of comment threads for a pull request.",
      {
        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 threads."),
        project: z.string().optional().describe("Project ID or project name (optional)"),
        iteration: z.number().optional().describe("The iteration ID for which to retrieve threads. Optional, defaults to the latest iteration."),
        baseIteration: z.number().optional().describe("The base iteration ID for which to retrieve threads. Optional, defaults to the latest base iteration."),
        top: z.number().default(100).describe("The maximum number of threads to return."),
        skip: z.number().default(0).describe("The number of threads to skip."),
        fullResponse: z.boolean().optional().default(false).describe("Return full thread JSON response instead of trimmed data."),
      },
      async ({ repositoryId, pullRequestId, project, iteration, baseIteration, top, skip, fullResponse }) => {
        const connection = await connectionProvider();
        const gitApi = await connection.getGitApi();
    
        const threads = await gitApi.getThreads(repositoryId, pullRequestId, project, iteration, baseIteration);
    
        const paginatedThreads = threads?.sort((a, b) => (a.id ?? 0) - (b.id ?? 0)).slice(skip, skip + top);
    
        if (fullResponse) {
          return {
            content: [{ type: "text", text: JSON.stringify(paginatedThreads, null, 2) }],
          };
        }
    
        // Return trimmed thread data focusing on essential information
        const trimmedThreads = paginatedThreads?.map((thread) => ({
          id: thread.id,
          publishedDate: thread.publishedDate,
          lastUpdatedDate: thread.lastUpdatedDate,
          status: thread.status,
          comments: trimComments(thread.comments),
        }));
    
        return {
          content: [{ type: "text", text: JSON.stringify(trimmedThreads, null, 2) }],
        };
      }
    );
  • Helper function used in the handler to trim and filter comments, excluding deleted ones and selecting essential properties.
    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,
        }));
    }
  • Mapping in REPO_TOOLS constant from internal name to the tool name string used in registration.
    list_pull_request_threads: "repo_list_pull_request_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 mentions retrieving a list but doesn't clarify key behaviors like pagination (implied by 'skip' and 'top' parameters but not explained), authentication requirements, rate limits, error handling, or whether the operation is read-only (though implied by 'Retrieve'). This leaves significant gaps for a tool with 8 parameters.

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 purpose without redundancy or fluff. It is appropriately front-loaded and wastes no words, making it easy for an agent to parse quickly.

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 lack of annotations and output schema, the description is minimally adequate but incomplete. It covers the basic purpose but misses behavioral details (e.g., pagination, auth) and output expectations, which are crucial for a list-retrieval tool with multiple parameters. The high schema coverage helps, but overall context remains sparse.

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, thoroughly documenting all 8 parameters, so the description adds no additional parameter information. This meets the baseline score of 3, as the schema adequately handles parameter semantics without needing description reinforcement.

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 verb ('Retrieve') and resource ('a list of comment threads for a pull request'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'repo_list_pull_request_thread_comments' or 'repo_list_pull_requests_by_repo', which handle 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, such as 'repo_list_pull_request_thread_comments' for individual comments or 'repo_list_pull_requests_by_repo' for pull request lists. It lacks context about prerequisites, exclusions, or typical use cases, leaving the agent to infer usage from the tool name 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

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