wait_for_suite_run
Monitors a test suite execution in BugBug by polling for completion status, returning detailed run results when finished. Configure timeout and polling intervals to manage wait duration.
Instructions
Waits until suite run finished, returns full suite run data as result
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pollIntervalSeconds | No | Polling interval in seconds (default: 10) | |
| runId | Yes | Suite run UUID to wait for | |
| timeoutMinutes | No | Maximum time to wait in minutes (default: 30) |
Implementation Reference
- src/tools/advanced.ts:83-137 (handler)The handler function implements polling logic to wait for a suite run to finish by repeatedly calling bugbugClient.getSuiteRun until the status is finished or timeout is reached. Returns text content with status or error.handler: async ({ runId, timeoutMinutes, pollIntervalSeconds }) => { try { const timeoutMs = timeoutMinutes * 60 * 1000; const pollIntervalMs = pollIntervalSeconds * 1000; let run = await bugbugClient.getSuiteRun(runId); if (isFinishedRunStatus(run.data.status)) { return { content: [ { type: 'text', text: `Suite run ${run.data.id} completed with status: ${run.data.status}`, }, ], }; } const startTime = Date.now(); while (Date.now() - startTime < timeoutMs) { await new Promise(resolve => setTimeout(resolve, pollIntervalMs)); run = await bugbugClient.getSuiteRun(runId); if (isFinishedRunStatus(run.data.status)) { return { content: [ { type: 'text', text: `Suite run ${run.data.id} completed with status: ${run.data.status}`, }, ], }; } } return { content: [ { type: 'text', text: `Suite run ${runId} did not complete within ${timeoutMinutes} minutes`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error waiting for suite run: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } },
- src/tools/advanced.ts:78-82 (schema)Input schema using Zod that validates runId (string, required), timeoutMinutes (number, optional default 30), pollIntervalSeconds (number, optional default 10).inputSchema: z.object({ runId: z.string().describe('Suite 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,
- src/tools/index.ts:11-33 (registration)Registration function that imports all tool modules including advancedTools containing waitForSuiteRunTool, collects them in a record, and registers each with the MCP server using server.registerTool, wrapping the handler.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) ); } }