get-builds
Retrieve Azure DevOps build definitions and recent builds to monitor pipeline status and track deployment progress across multiple organizations.
Instructions
Get build definitions and recent builds
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| definitionIds | No | Specific build definition IDs | |
| top | No | Number of builds to return |
Implementation Reference
- src/handlers/tool-handlers.ts:945-991 (handler)Main handler function for 'get-builds' tool. Queries Azure DevOps /build/builds API endpoint with optional definitionIds and top parameters, formats the response with relevant build details.
private async getBuilds(args: any): Promise<any> { try { let endpoint = '/build/builds?api-version=7.1'; const params = []; if (args.definitionIds && args.definitionIds.length > 0) { params.push(`definitions=${args.definitionIds.join(',')}`); } if (args.top) { params.push(`$top=${args.top}`); } else { params.push('$top=10'); // Default to 10 builds } if (params.length > 0) { endpoint += '&' + params.join('&'); } const result = await this.makeApiRequest(endpoint); const builds = result.value.map((build: any) => ({ id: build.id, buildNumber: build.buildNumber, status: build.status, result: build.result, definition: { id: build.definition.id, name: build.definition.name }, startTime: build.startTime, finishTime: build.finishTime, url: build._links.web.href })); return { content: [{ type: 'text', text: JSON.stringify({ count: builds.length, builds }, null, 2), }], }; } catch (error) { throw new Error(`Failed to get builds: ${error instanceof Error ? error.message : 'Unknown error'}`); } } - src/index.ts:242-259 (registration)Registers the 'get-builds' tool with the MCP server in the listTools handler, including input schema for parameters definitionIds and top.
{ name: 'get-builds', description: 'Get build definitions and recent builds', inputSchema: { type: 'object', properties: { definitionIds: { type: 'array', items: { type: 'number' }, description: 'Specific build definition IDs', }, top: { type: 'number', description: 'Number of builds to return', }, }, }, }, - src/handlers/tool-handlers.ts:43-44 (handler)Dispatch case in handleToolCall method that routes 'get-builds' tool calls to the getBuilds implementation.
case 'get-builds': return await this.getBuilds(args || {});