get_test_run_screenshots
Retrieve visual evidence from automated test executions by providing a test run identifier to capture screenshots for debugging and verification purposes.
Instructions
Get screenshots from a BugBug test run
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| runId | Yes | Test run UUID |
Implementation Reference
- src/tools/testRuns.ts:168-221 (handler)Full tool definition including the handler function that fetches and lists screenshots from a test run using the bugbugClient. This is the core implementation of the tool logic.export const getTestRunScreenshotsTool: Tool = { name: 'get_test_run_screenshots', title: 'Get screenshots from a BugBug test run', description: 'Get screenshots from a BugBug test run', inputSchema: z.object({ runId: z.string().describe('Test run UUID'), }).shape, handler: async ({ runId }) => { try { const response = await bugbugClient.getTestRunScreenshots(runId); if (response.status !== 200) { return { content: [ { type: 'text', text: `Error: ${response.status} ${response.statusText}`, }, ], }; } const screenshots = response.data; let screenshotsList = ''; if (screenshots.stepsRuns && screenshots.stepsRuns.length > 0) { screenshotsList = screenshots.stepsRuns.map((step: BugBugStepDetail) => `- **Step ${step.stepId}:** ${step.screenshots?.[0]?.url || 'No screenshot'}` ).join('\n'); } else { screenshotsList = 'No screenshots available'; } return { content: [ { type: 'text', text: `**Test Run Screenshots (ID: ${screenshots.id}):**\n\n${screenshotsList}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching test run screenshots: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } };
- src/tools/testRuns.ts:172-174 (schema)Zod input schema for the tool, requiring a runId string.inputSchema: z.object({ runId: z.string().describe('Test run UUID'), }).shape,
- src/tools/index.ts:11-33 (registration)Registers all tools on the MCP server, including those from testRunsTools (which exports getTestRunScreenshotsTool) by iterating over the tools record and calling server.registerTool.export function registerAllTools(server: McpServer): void { const tools: Record<string, Tool> = { ...configTools, ...testsTools, ...testRunsTools, ...suitesTools, ...suiteRunsTools, ...profilesTools, ...advancedTools, }; for (const t in tools) { server.registerTool( tools[t].name, { description: tools[t].description, inputSchema: tools[t].inputSchema, annotations: { title: tools[t].title }, }, (args: unknown) => tools[t].handler(args as unknown) ); } }
- src/services/bugbugClient.ts:238-240 (helper)The bugbugClient method called by the tool handler to make the API request for test run screenshots.async getTestRunScreenshots(id: string): Promise<ApiResponse<BugBugScreenshotResponse>> { return this.makeRequest(`/testruns/${id}/screenshots/`); }