build_get_log_by_id
Retrieve a specific build log by ID from Azure DevOps, allowing access to detailed log content within a specified line range for targeted debugging and analysis.
Instructions
Get a specific build log by log ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buildId | Yes | ID of the build to get the log for | |
| endLine | No | Ending line number for the log content, defaults to the end of the log | |
| logId | Yes | ID of the log to retrieve | |
| project | Yes | Project ID or name to get the build log for | |
| startLine | No | Starting line number for the log content, defaults to 0 |
Implementation Reference
- src/tools/builds.ts:228-236 (handler)Handler function that calls Azure DevOps Build API to retrieve specific log lines (* to endLine) for a given build and log ID.async ({ project, buildId, logId, startLine, endLine }) => { const connection = await connectionProvider(); const buildApi = await connection.getBuildApi(); const logLines = await buildApi.getBuildLogLines(project, buildId, logId, startLine, endLine); return { content: [{ type: "text", text: JSON.stringify(logLines, null, 2) }], }; }
- src/tools/builds.ts:222-227 (schema)Input validation schema using Zod for the tool parameters.project: z.string().describe("Project ID or name to get the build log for"), buildId: z.number().describe("ID of the build to get the log for"), logId: z.number().describe("ID of the log to retrieve"), startLine: z.number().optional().describe("Starting line number for the log content, defaults to 0"), endLine: z.number().optional().describe("Ending line number for the log content, defaults to the end of the log"), },
- src/tools/builds.ts:218-237 (registration)Registration of the 'build_get_log_by_id' tool on the MCP server via server.tool(BUILD_TOOLS.get_log_by_id, ...), where BUILD_TOOLS.get_log_by_id = 'build_get_log_by_id'.server.tool( BUILD_TOOLS.get_log_by_id, "Get a specific build log by log ID.", { project: z.string().describe("Project ID or name to get the build log for"), buildId: z.number().describe("ID of the build to get the log for"), logId: z.number().describe("ID of the log to retrieve"), startLine: z.number().optional().describe("Starting line number for the log content, defaults to 0"), endLine: z.number().optional().describe("Ending line number for the log content, defaults to the end of the log"), }, async ({ project, buildId, logId, startLine, endLine }) => { const connection = await connectionProvider(); const buildApi = await connection.getBuildApi(); const logLines = await buildApi.getBuildLogLines(project, buildId, logId, startLine, endLine); return { content: [{ type: "text", text: JSON.stringify(logLines, null, 2) }], }; } );
- src/tools/builds.ts:17-17 (helper)Constant mapping in BUILD_TOOLS object linking internal key 'get_log_by_id' to the actual tool name 'build_get_log_by_id'.get_log_by_id: "build_get_log_by_id",