Skip to main content
Glama

get_pull_request_checks

Retrieve status checks and policy evaluations for Azure DevOps pull requests to identify blocking validations and pipeline issues.

Instructions

Summarize the latest status checks and policy evaluations for a pull request.

  • Surfaces pipeline and run identifiers so you can jump straight to the blocking validation.

  • Pair with pipeline tools (e.g., get_pipeline_run, pipeline_timeline) to inspect failures in depth.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
organizationIdNoThe ID or name of the organization (Default: mycompany)
repositoryIdYesThe ID or name of the repository
pullRequestIdYesThe ID of the pull request

Implementation Reference

  • Main handler function that fetches pull request statuses and policy evaluations from Azure DevOps APIs, maps them to the response format, and handles errors.
    export async function getPullRequestChecks( connection: WebApi, options: PullRequestChecksOptions, ): Promise<PullRequestChecksResult> { try { const [gitApi, policyApi, projectId] = await Promise.all([ connection.getGitApi(), connection.getPolicyApi(), resolveProjectId(connection, options.projectId), ]); const [statusRecords, evaluationRecords] = await Promise.all([ gitApi.getPullRequestStatuses( options.repositoryId, options.pullRequestId, projectId, ), policyApi.getPolicyEvaluations( projectId, buildPolicyArtifactId(projectId, options.pullRequestId), ), ]); return { statuses: (statusRecords ?? []).map(mapStatusRecord), policyEvaluations: (evaluationRecords ?? []).map(mapEvaluationRecord), }; } catch (error) { if (error instanceof AzureDevOpsError) { throw error; } throw new Error( `Failed to get pull request checks: ${ error instanceof Error ? error.message : String(error) }`, ); } }
  • Zod input schema for validating tool arguments: projectId, organizationId, repositoryId, pullRequestId.
    export const GetPullRequestChecksSchema = z.object({ projectId: z .string() .optional() .describe(`The ID or name of the project (Default: ${defaultProject})`), organizationId: z .string() .optional() .describe(`The ID or name of the organization (Default: ${defaultOrg})`), repositoryId: z.string().describe('The ID or name of the repository'), pullRequestId: z.number().describe('The ID of the pull request'), });
  • MCP tool registration defining the tool name, description, and JSON schema for inputs.
    { name: 'get_pull_request_checks', description: [ 'Summarize the latest status checks and policy evaluations for a pull request.', '- Surfaces pipeline and run identifiers so you can jump straight to the blocking validation.', '- Pair with pipeline tools (e.g., get_pipeline_run, pipeline_timeline) to inspect failures in depth.', ].join('\n'), inputSchema: zodToJsonSchema(GetPullRequestChecksSchema), },
  • Request handler router that parses arguments with schema and dispatches to the getPullRequestChecks handler.
    case 'get_pull_request_checks': { const params = GetPullRequestChecksSchema.parse(request.params.arguments); const result = await getPullRequestChecks(connection, { projectId: params.projectId ?? defaultProject, repositoryId: params.repositoryId, pullRequestId: params.pullRequestId, }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • Helper function to resolve project ID or name to GUID using Core API.
    const resolveProjectId = async ( connection: WebApi, projectIdOrName: string, ): Promise<string> => { if (projectIdGuidPattern.test(projectIdOrName)) { return projectIdOrName; } const coreApi = await connection.getCoreApi(); const project = await coreApi.getProject(projectIdOrName); if (!project?.id) { throw new AzureDevOpsResourceNotFoundError( `Project '${projectIdOrName}' not found`, ); } return project.id; };

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/Tiberriver256/mcp-server-azure-devops'

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