Skip to main content
Glama
mmruesch12
by mmruesch12

list_pull_requests

Filter and retrieve pull requests by status (active, completed, abandoned) in a repository using this tool on the azure-devops MCP Server.

Instructions

List pull requests in a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoFilter by PR status

Implementation Reference

  • The main handler function that implements the list_pull_requests tool logic. It parses input, fetches pull requests using the Git client based on status, and returns them as JSON.
    export async function listPullRequests(rawParams: any) {
      // Parse arguments with defaults from environment variables
      const params = listPullRequestsSchema.parse({
        status: rawParams.status,
      });
    
      console.error("[API] Listing pull requests:", params);
    
      try {
        // Get the Git API client
        const gitClient = await getGitClient();
    
        // Convert status string to number
        let statusId: number | undefined;
        if (params.status) {
          switch (params.status) {
            case "active":
              statusId = 1;
              break;
            case "completed":
              statusId = 3;
              break;
            case "abandoned":
              statusId = 2;
              break;
          }
        }
    
        // Get pull requests
        if (!DEFAULT_PROJECT || !DEFAULT_REPOSITORY) {
          throw new Error("Default project and repository must be configured");
        }
    
        const pullRequests = await gitClient.getPullRequests(
          DEFAULT_REPOSITORY,
          { status: statusId },
          DEFAULT_PROJECT
        );
    
        console.error(`[API] Found ${pullRequests.length} pull requests`);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(pullRequests, null, 2),
            },
          ],
        };
      } catch (error) {
        logError("Error listing pull requests", error);
        throw error;
      }
    }
  • Zod schema used for input validation and parsing in the handler function.
    export const listPullRequestsSchema = z.object({
      status: z.enum(["active", "completed", "abandoned"]).optional(),
    });
    
    export type ListPullRequestsParams = z.infer<typeof listPullRequestsSchema>;
  • Tool registration definition within the pullRequestTools array, including name, description, and input schema. This is returned by listTools.
    {
      name: "list_pull_requests",
      description: "List pull requests in a repository",
      inputSchema: {
        type: "object",
        properties: {
          status: {
            type: "string",
            enum: ["active", "completed", "abandoned"],
            description: "Filter by PR status",
          },
        },
        required: [],
      },
    },
  • src/index.ts:77-78 (registration)
    Dispatcher in the main server CallToolRequest handler that routes calls to the listPullRequests function.
    case "list_pull_requests":
      return await listPullRequests(request.params.arguments || {});
  • src/index.ts:50-63 (registration)
    Registration of tools list handler that includes pullRequestTools containing the list_pull_requests tool.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          // Work Items
          ...workItemTools,
          // Pull Requests
          ...pullRequestTools,
          // Wiki
          ...wikiTools,
          // Projects
          ...projectTools,
        ],
      };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It only states the action without disclosing behavioral traits such as pagination, rate limits, authentication needs, or output format. For a list operation with no annotations, this is inadequate.

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 no wasted words. It is appropriately sized and front-loaded, making it easy to parse quickly.

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 (list operation with filtering), lack of annotations, and no output schema, the description is incomplete. It fails to explain return values, error handling, or other contextual details needed for effective use.

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%, with one parameter ('status') fully documented in the schema. The description adds no additional meaning about parameters beyond what the schema provides, so it meets the baseline of 3 without compensating or detracting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List pull requests in a repository' states the verb ('List') and resource ('pull requests'), providing a basic purpose. However, it lacks specificity about scope (e.g., all PRs vs. filtered) and does not distinguish it from sibling tools like 'get_pull_request' (which likely fetches a single PR). This makes it vague but not tautological.

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 offers no guidance on when to use this tool versus alternatives. It does not mention sibling tools like 'get_pull_request' for single PRs or 'list_projects' for broader context, nor does it specify prerequisites (e.g., repository access). This leaves usage unclear.

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/mmruesch12/azdo-mcp'

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