Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_list_pull_requests_by_commits

Find pull requests containing specific commits in an Azure DevOps repository. Query by commit IDs to accurately track and manage code changes across project branches.

Instructions

Lists pull requests by commit IDs to find which pull requests contain specific commits

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commitsYesArray of commit IDs to query for
projectYesProject name or ID
queryTypeNoType of query to performLastMergeCommit
repositoryYesRepository name or ID

Implementation Reference

  • The main handler function that constructs a GitPullRequestQuery from the input commits and calls the Azure DevOps Git API's getPullRequestQuery method to find pull requests containing those commits.
    async ({ project, repository, commits, queryType }) => {
      try {
        const connection = await connectionProvider();
        const gitApi = await connection.getGitApi();
    
        const query: GitPullRequestQuery = {
          queries: [
            {
              items: commits,
              type: GitPullRequestQueryType[queryType as keyof typeof GitPullRequestQueryType],
            } as GitPullRequestQueryInput,
          ],
        };
    
        const queryResult = await gitApi.getPullRequestQuery(query, repository, project);
    
        return {
          content: [{ type: "text", text: JSON.stringify(queryResult, null, 2) }],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error querying pull requests by commits: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema for input validation, defining parameters project, repository, commits (array of strings), and optional queryType.
      project: z.string().describe("Project name or ID"),
      repository: z.string().describe("Repository name or ID"),
      commits: z.array(z.string()).describe("Array of commit IDs to query for"),
      queryType: z
        .enum(pullRequestQueryTypesStrings as [string, ...string[]])
        .optional()
        .default(GitPullRequestQueryType[GitPullRequestQueryType.LastMergeCommit])
        .describe("Type of query to perform"),
    },
  • Registers the tool with the MCP server using server.tool, specifying the name from REPO_TOOLS, description, input schema, and handler function.
    server.tool(
      REPO_TOOLS.list_pull_requests_by_commits,
      "Lists pull requests by commit IDs to find which pull requests contain specific commits",
      {
        project: z.string().describe("Project name or ID"),
        repository: z.string().describe("Repository name or ID"),
        commits: z.array(z.string()).describe("Array of commit IDs to query for"),
        queryType: z
          .enum(pullRequestQueryTypesStrings as [string, ...string[]])
          .optional()
          .default(GitPullRequestQueryType[GitPullRequestQueryType.LastMergeCommit])
          .describe("Type of query to perform"),
      },
      async ({ project, repository, commits, queryType }) => {
        try {
          const connection = await connectionProvider();
          const gitApi = await connection.getGitApi();
    
          const query: GitPullRequestQuery = {
            queries: [
              {
                items: commits,
                type: GitPullRequestQueryType[queryType as keyof typeof GitPullRequestQueryType],
              } as GitPullRequestQueryInput,
            ],
          };
    
          const queryResult = await gitApi.getPullRequestQuery(query, repository, project);
    
          return {
            content: [{ type: "text", text: JSON.stringify(queryResult, null, 2) }],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error querying pull requests by commits: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Defines the tool name mapping in the REPO_TOOLS constant object.
    list_pull_requests_by_commits: "repo_list_pull_requests_by_commits",
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It doesn't describe what the tool returns (e.g., format, pagination), error conditions, rate limits, authentication needs, or whether it's a read-only operation. The description only states what it does at a high level without operational details.

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 clearly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded with the essential information.

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 has no annotations and no output schema, the description is insufficiently complete. For a tool with 4 parameters that queries pull requests by commits, users need more information about what the tool returns, error handling, and behavioral characteristics that aren't covered by the input 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 already documents all four parameters thoroughly. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it mentions 'commit IDs' which aligns with the 'commits' parameter but provides no additional context about parameter usage or interactions.

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

Purpose5/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 with specific verbs ('Lists pull requests') and resources ('by commit IDs'), and distinguishes it from sibling tools like 'repo_list_pull_requests_by_project' or 'repo_list_pull_requests_by_repo' by specifying the unique query mechanism based on commit IDs.

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 prerequisites, when it's appropriate compared to other pull request listing tools, or any limitations in its functionality.

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