Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_list_pull_requests_by_project

Retrieve a list of pull requests for a specific Azure DevOps project, filtered by status, creator, or reviewer. Use this tool to efficiently manage and track pull requests within your project.

Instructions

Retrieve a list of pull requests for a given project Id or Name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
created_by_meNoFilter pull requests created by the current user.
i_am_reviewerNoFilter pull requests where the current user is a reviewer.
projectYesThe name or ID of the Azure DevOps project.
skipNoThe number of pull requests to skip.
statusNoFilter pull requests by status. Defaults to 'Active'.Active
topNoThe maximum number of pull requests to return.

Implementation Reference

  • Registration of the tool name mapping from internal handler 'list_pull_requests_by_project' to the public tool name 'repo_list_pull_requests_by_project' in the REPO_TOOLS constant.
    list_pull_requests_by_project: "repo_list_pull_requests_by_project",
  • Zod schema defining the input parameters for the tool, including project, pagination options, user filters, and status.
    {
      project: z.string().describe("The name or ID of the Azure DevOps project."),
      top: z.number().default(100).describe("The maximum number of pull requests to return."),
      skip: z.number().default(0).describe("The number of pull requests to skip."),
      created_by_me: z.boolean().default(false).describe("Filter pull requests created by the current user."),
      i_am_reviewer: z.boolean().default(false).describe("Filter pull requests where the current user is a reviewer."),
      status: z
        .enum(getEnumKeys(PullRequestStatus) as [string, ...string[]])
        .default("Active")
        .describe("Filter pull requests by status. Defaults to 'Active'."),
    },
  • The core handler function that fetches pull requests for a project using the Azure DevOps Git API, applies filters based on user and status, trims the response data, and returns it as JSON text.
    async ({ project, top, skip, created_by_me, i_am_reviewer, status }) => {
      const connection = await connectionProvider();
      const gitApi = await connection.getGitApi();
    
      // Build the search criteria
      const gitPullRequestSearchCriteria: {
        status: number;
        creatorId?: string;
        reviewerId?: string;
      } = {
        status: pullRequestStatusStringToInt(status),
      };
    
      if (created_by_me || i_am_reviewer) {
        const data = await getCurrentUserDetails(tokenProvider, connectionProvider, userAgentProvider);
        const userId = data.authenticatedUser.id;
        if (created_by_me) {
          gitPullRequestSearchCriteria.creatorId = userId;
        }
        if (i_am_reviewer) {
          gitPullRequestSearchCriteria.reviewerId = userId;
        }
      }
    
      const pullRequests = await gitApi.getPullRequestsByProject(
        project,
        gitPullRequestSearchCriteria,
        undefined, // maxCommentLength
        skip,
        top
      );
    
      // Filter out the irrelevant properties
      const filteredPullRequests = pullRequests?.map((pr) => ({
        pullRequestId: pr.pullRequestId,
        codeReviewId: pr.codeReviewId,
        repository: pr.repository?.name,
        status: pr.status,
        createdBy: {
          displayName: pr.createdBy?.displayName,
          uniqueName: pr.createdBy?.uniqueName,
        },
        creationDate: pr.creationDate,
        title: pr.title,
        isDraft: pr.isDraft,
        sourceRefName: pr.sourceRefName,
        targetRefName: pr.targetRefName,
      }));
    
      return {
        content: [{ type: "text", text: JSON.stringify(filteredPullRequests, null, 2) }],
      };
    }
  • Helper function to convert a pull request status string to the corresponding integer value from PullRequestStatus enum, used in the handler to set the status filter.
    function pullRequestStatusStringToInt(status: string): number {
      switch (status) {
        case "Abandoned":
          return PullRequestStatus.Abandoned.valueOf();
        case "Active":
          return PullRequestStatus.Active.valueOf();
        case "All":
          return PullRequestStatus.All.valueOf();
        case "Completed":
          return PullRequestStatus.Completed.valueOf();
        case "NotSet":
          return PullRequestStatus.NotSet.valueOf();
        default:
          throw new Error(`Unknown pull request status: ${status}`);
      }
    }
  • src/tools.ts:23-23 (registration)
    High-level registration call to configureRepoTools, which registers all repository tools including repo_list_pull_requests_by_project.
    configureRepoTools(server, tokenProvider, connectionProvider, userAgentProvider);
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 retrieval but lacks details on permissions, rate limits, pagination (beyond schema defaults), or response format. For a list operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 with zero waste. It front-loads the core purpose without unnecessary elaboration, making it easy 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 tool's moderate complexity (6 parameters, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the basic purpose but lacks behavioral context, usage guidelines, and output details, leaving the agent to rely heavily on the schema alone.

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 fully documents all 6 parameters. The description adds no additional parameter semantics beyond implying filtering by project, which is already covered in the schema. This meets the baseline for high schema coverage.

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 resource ('pull requests for a given project'), making the purpose understandable. It doesn't explicitly differentiate from siblings like 'repo_list_pull_requests_by_repo' or 'repo_list_pull_requests_by_commits', which would require a 5.

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 like 'repo_list_pull_requests_by_repo' or 'repo_list_pull_requests_by_commits', nor does it mention prerequisites or exclusions. It merely restates the basic functionality without contextual advice.

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