Skip to main content
Glama

get-builds

Retrieve build definitions and recent builds from Azure DevOps. Specify build definition IDs and the number of builds to fetch for streamlined DevOps pipeline management.

Instructions

Get build definitions and recent builds

Input Schema

NameRequiredDescriptionDefault
definitionIdsNoSpecific build definition IDs
topNoNumber of builds to return

Input Schema (JSON Schema)

{ "properties": { "definitionIds": { "description": "Specific build definition IDs", "items": { "type": "number" }, "type": "array" }, "top": { "description": "Number of builds to return", "type": "number" } }, "type": "object" }

Implementation Reference

  • The getBuilds method that implements the core logic for retrieving builds from Azure DevOps API. Supports filtering by definitionIds and limiting results with top parameter. Uses makeApiRequest to fetch from /build/builds endpoint.
    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'}`); } }
  • The handleToolCall switch statement registers and dispatches the 'get-builds' tool call to the corresponding getBuilds handler method.
    switch (name) { case 'get-work-items': return await this.getWorkItems(args || {}); case 'create-work-item': return await this.createWorkItem(args || {}); case 'update-work-item': return await this.updateWorkItem(args || {}); case 'add-work-item-comment': return await this.addWorkItemComment(args || {}); case 'get-repositories': return await this.getRepositories(args || {}); case 'get-builds': return await this.getBuilds(args || {}); case 'get-pull-requests': return await this.getPullRequests(args || {}); case 'trigger-pipeline': return await this.triggerPipeline(args || {}); case 'get-pipeline-status': return await this.getPipelineStatus(args || {}); default: throw new Error(`Unknown tool: ${name}`); }
  • Defines the input schema, name, and description for the 'get-builds' tool in the listTools response.
    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', }, }, }, },

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/wangkanai/devops-enhanced-mcp'

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