Skip to main content
Glama
simplypixi

BugBug MCP Server

by simplypixi

wait_for_test_run

Waits for a BugBug test run to complete by polling its status, then returns the full test run results. Specify the run ID and optional timeout/polling intervals to monitor automated test execution.

Instructions

Waits until test run finished, returns full test run data as result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pollIntervalSecondsNoPolling interval in seconds (default: 10)
runIdYesTest run UUID to wait for
timeoutMinutesNoMaximum time to wait in minutes (default: 30)

Implementation Reference

  • The handler function polls the bugbugClient for test run status at intervals until the run finishes (via isFinishedRunStatus check), retrieves full details including screenshots, or times out. Returns appropriate content (text summary/images or error/timeout messages).
    handler: async ({ runId, timeoutMinutes = 30, pollIntervalSeconds = 10 }) => {
      try {
        const startTime = Date.now();
        const timeoutMs = timeoutMinutes * 60 * 1000;
        const pollIntervalMs = pollIntervalSeconds * 1000;
    
        while (Date.now() - startTime < timeoutMs) {
          const statusResponse = await bugbugClient.getTestRunStatus(runId);
    
          if (statusResponse.status !== 200) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Error checking test run status: ${statusResponse.status} ${statusResponse.statusText}`,
                },
              ],
            };
          }
    
          if (isFinishedRunStatus(statusResponse.data.status)) {
            const runDetails = await bugbugClient.getTestRun(runId);
            const summary: CallToolResult['content'] = [
              {
                type: 'text',
                text: createTestRunSummary(runDetails.data),
              },
            ];
            const screenshotMessages: CallToolResult['content'] = runDetails.data.screenshots?.map(screenshot => ({
              type: 'image',
              data: screenshot,
              mimeType: 'image/png',
            })) || [];
    
            return {
              content: [...summary, ...screenshotMessages],
            };
          }
    
          await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `Test run ${runId} did not finish within ${timeoutMinutes} minutes`,
            },
          ],
        };
      } catch (error) {
        return createToolError(error, 'Error waiting for test run');
      }
    },
  • Zod schema for tool inputs: required runId (UUID string), optional timeoutMinutes (default 30), optional pollIntervalSeconds (default 10).
    inputSchema: z.object({
      runId: z.string().describe('Test run UUID to wait for'),
      timeoutMinutes: z.number().optional().default(30).describe('Maximum time to wait in minutes (default: 30)'),
      pollIntervalSeconds: z.number().optional().default(10).describe('Polling interval in seconds (default: 10)'),
    }).shape,
  • Registers all tools (including waitForTestRunTool from advancedTools namespace) with the MCP server using their name, description, inputSchema, title, and handler functions.
    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)
        );
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only provide a title, so the description carries the burden of behavioral disclosure. It adds value by describing the waiting/polling behavior and that it returns full test run data, which isn't obvious from the title or schema. However, it lacks details on error handling, what 'finished' means (e.g., success/failure states), or rate limits, leaving gaps for a tool with polling logic.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality ('waits until test run finished') and adds the outcome ('returns full test run data as result'). There's no wasted verbiage, and it's appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's polling behavior and lack of output schema, the description is minimally adequate but incomplete. It covers the basic action and result but omits details like response format, error conditions, or how 'finished' is defined. With no annotations and no output schema, more context would help the agent use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema itself. The description doesn't add any semantic details beyond what the schema provides (e.g., it doesn't explain how polling interacts with runId or defaults). This meets the baseline for high schema coverage but doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('waits until test run finished') and the resource ('test run'), making the purpose immediately understandable. It distinguishes from siblings like 'get_test_run_status' by emphasizing the waiting behavior and full data return, though it could be more explicit about differentiation from 'wait_for_suite_run'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives is provided. The description implies usage for monitoring test run completion, but it doesn't specify prerequisites, when to choose this over 'get_test_run_status' for polling, or any exclusions. This leaves the agent without clear decision-making context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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