Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_get_pull_request_by_id

Retrieve a specific pull request by its ID from an Azure DevOps repository. Optionally include associated work item references for detailed tracking and management.

Instructions

Get a pull request by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeWorkItemRefsNoWhether to reference work items associated with the pull request.
pullRequestIdYesThe ID of the pull request to retrieve.
repositoryIdYesThe ID of the repository where the pull request is located.

Implementation Reference

  • The handler function retrieves the specified pull request using the Azure DevOps Git API's getPullRequest method and returns its details as a JSON-formatted text response.
    async ({ repositoryId, pullRequestId, includeWorkItemRefs }) => { const connection = await connectionProvider(); const gitApi = await connection.getGitApi(); const pullRequest = await gitApi.getPullRequest(repositoryId, pullRequestId, undefined, undefined, undefined, undefined, undefined, includeWorkItemRefs); return { content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }], }; }
  • Zod schema defining the input parameters for the tool: repositoryId (string), pullRequestId (number), and optional includeWorkItemRefs (boolean).
    { repositoryId: z.string().describe("The ID of the repository where the pull request is located."), pullRequestId: z.number().describe("The ID of the pull request to retrieve."), includeWorkItemRefs: z.boolean().optional().default(false).describe("Whether to reference work items associated with the pull request."), },
  • Registration of the tool using McpServer.tool(), associating the name REPO_TOOLS.get_pull_request_by_id ("repo_get_pull_request_by_id") with its description, input schema, and handler function.
    server.tool( REPO_TOOLS.get_pull_request_by_id, "Get a pull request by its ID.", { repositoryId: z.string().describe("The ID of the repository where the pull request is located."), pullRequestId: z.number().describe("The ID of the pull request to retrieve."), includeWorkItemRefs: z.boolean().optional().default(false).describe("Whether to reference work items associated with the pull request."), }, async ({ repositoryId, pullRequestId, includeWorkItemRefs }) => { const connection = await connectionProvider(); const gitApi = await connection.getGitApi(); const pullRequest = await gitApi.getPullRequest(repositoryId, pullRequestId, undefined, undefined, undefined, undefined, undefined, includeWorkItemRefs); return { content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }], }; } );
  • Mapping in REPO_TOOLS constant that associates the internal identifier 'get_pull_request_by_id' with the tool name 'repo_get_pull_request_by_id'.
    get_pull_request_by_id: "repo_get_pull_request_by_id",

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