Skip to main content
Glama
simplypixi

BugBug MCP Server

by simplypixi

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
NameRequiredDescriptionDefault
runIdYesTest run UUID

Implementation Reference

  • 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'}`,
                },
              ],
            };
          }
        }
    };
  • Zod input schema for the tool, requiring a runId string.
    inputSchema: z.object({
      runId: z.string().describe('Test run UUID'),
    }).shape,
  • 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)
        );
      }
    }
  • 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/`);
    }

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/simplypixi/bugbug-mcp-server'

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