Skip to main content
Glama
nikydobrev

Azure DevOps Multi-Organization MCP Server

by nikydobrev

git_get_pull_requests

Retrieve and filter pull requests from Azure DevOps repositories by status, creator, reviewer, or branch to track code review progress across organizations.

Instructions

Gets a list of pull requests in a repository with filtering options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationYesThe name of the Azure DevOps organization
projectYesProject ID or name
repositoryIdYesThe repository ID or name
statusNoFilter by PR status (Active, Abandoned, Completed, All)
creatorIdNoFilter by creator ID
reviewerIdNoFilter by reviewer ID
sourceRefNameNoFilter by source branch name (e.g. refs/heads/feature/1)
targetRefNameNoFilter by target branch name (e.g. refs/heads/main)
topNoNumber of results to return

Implementation Reference

  • The asynchronous handler function that executes the core logic of the git_get_pull_requests tool. It connects to Azure DevOps, constructs search criteria, fetches pull requests using the Git API, simplifies the data, and returns it as JSON.
    async ({ organization, project, repositoryId, status, creatorId, reviewerId, sourceRefName, targetRefName, top }) => { const connection = await connectionManager.getConnection(organization); const gitApi = await connection.getGitApi(); const searchCriteria: any = { status: safeEnumConvert<PullRequestStatus>(PullRequestStatus, status), creatorId, reviewerId, sourceRefName, targetRefName }; const prs = await gitApi.getPullRequests( repositoryId, searchCriteria, project, undefined, undefined, top || 20 ); const simplified = prs.map(pr => ({ pullRequestId: pr.pullRequestId, title: pr.title, description: pr.description, status: pr.status, creationDate: pr.creationDate, createdBy: pr.createdBy?.displayName, sourceRefName: pr.sourceRefName, targetRefName: pr.targetRefName, url: pr.url })); return { content: [{ type: "text", text: JSON.stringify(simplified, null, 2) }], }; }
  • Zod schema defining the input parameters and their descriptions for the git_get_pull_requests tool, including organization, project, repository, filters, and pagination.
    { organization: z.string().describe("The name of the Azure DevOps organization"), project: z.string().describe("Project ID or name"), repositoryId: z.string().describe("The repository ID or name"), status: z.enum(getEnumKeys(PullRequestStatus)).optional().describe("Filter by PR status (Active, Abandoned, Completed, All)"), creatorId: z.string().optional().describe("Filter by creator ID"), reviewerId: z.string().optional().describe("Filter by reviewer ID"), sourceRefName: z.string().optional().describe("Filter by source branch name (e.g. refs/heads/feature/1)"), targetRefName: z.string().optional().describe("Filter by target branch name (e.g. refs/heads/main)"), top: z.number().optional().describe("Number of results to return"), },
  • Registration of the git_get_pull_requests tool using McpServer.tool(), specifying name, description, input schema, and handler function.
    server.tool( "git_get_pull_requests", "Gets a list of pull requests in a repository with filtering options", { organization: z.string().describe("The name of the Azure DevOps organization"), project: z.string().describe("Project ID or name"), repositoryId: z.string().describe("The repository ID or name"), status: z.enum(getEnumKeys(PullRequestStatus)).optional().describe("Filter by PR status (Active, Abandoned, Completed, All)"), creatorId: z.string().optional().describe("Filter by creator ID"), reviewerId: z.string().optional().describe("Filter by reviewer ID"), sourceRefName: z.string().optional().describe("Filter by source branch name (e.g. refs/heads/feature/1)"), targetRefName: z.string().optional().describe("Filter by target branch name (e.g. refs/heads/main)"), top: z.number().optional().describe("Number of results to return"), }, async ({ organization, project, repositoryId, status, creatorId, reviewerId, sourceRefName, targetRefName, top }) => { const connection = await connectionManager.getConnection(organization); const gitApi = await connection.getGitApi(); const searchCriteria: any = { status: safeEnumConvert<PullRequestStatus>(PullRequestStatus, status), creatorId, reviewerId, sourceRefName, targetRefName }; const prs = await gitApi.getPullRequests( repositoryId, searchCriteria, project, undefined, undefined, top || 20 ); const simplified = prs.map(pr => ({ pullRequestId: pr.pullRequestId, title: pr.title, description: pr.description, status: pr.status, creationDate: pr.creationDate, createdBy: pr.createdBy?.displayName, sourceRefName: pr.sourceRefName, targetRefName: pr.targetRefName, url: pr.url })); return { content: [{ type: "text", text: JSON.stringify(simplified, null, 2) }], }; } );

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/nikydobrev/mcp-server-azure-devops-multi'

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