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",

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