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) }],
        };
      }
    );
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. It mentions 'filtering options' but doesn't describe key behaviors like pagination (the 'top' parameter suggests limited results), authentication requirements, rate limits, error handling, or the format of returned data. For a read operation with multiple parameters, this leaves significant gaps.

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 front-loads the core purpose ('Gets a list of pull requests') and adds a key feature ('with filtering options'). There is no wasted language, and it's appropriately sized for the tool's complexity.

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 complexity (9 parameters, no annotations, no output schema), the description is incomplete. It doesn't address behavioral aspects like pagination, authentication, or data format, and while the schema covers parameters, the lack of output schema means the description should ideally hint at return values. For a list operation with filtering, more context is needed.

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%, so the schema already documents all 9 parameters with descriptions and enums. The description adds minimal value beyond the schema by mentioning 'filtering options' generically, but doesn't provide additional context like parameter interactions or examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: 'Gets a list of pull requests in a repository with filtering options.' It specifies the verb ('Gets'), resource ('pull requests'), and scope ('in a repository'), but doesn't explicitly differentiate it from sibling tools like 'git_get_pull_request' (singular) or 'git_list_repositories'.

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 sibling tools like 'git_get_pull_request' (for a single PR) or 'git_list_repositories' (for listing repositories), nor does it specify prerequisites or exclusions. Usage is implied by the name and description 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/nikydobrev/mcp-server-azure-devops-multi'

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