stop_test_run
Stop an active BugBug test run by providing its unique run ID to halt execution and conserve testing resources.
Instructions
Stop a running BugBug test run
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| runId | Yes | Test run UUID to stop |
Implementation Reference
- src/tools/testRuns.ts:230-266 (handler)The handler function that executes the stop_test_run tool logic: calls the BugBug client to stop the run, handles response or error, and returns formatted text content.handler: async ({ runId }) => { try { const response = await bugbugClient.stopTestRun(runId); if (response.status !== 200) { return { content: [ { type: 'text', text: `Error: ${response.status} ${response.statusText}`, }, ], }; } const status = response.data; return { content: [ { type: 'text', text: `**Test Run Stopped:**\n\n- **ID:** ${status.id}\n- **Status:** ${status.status}\n- **Last Modified:** ${status.modified}\n- **Web App URL:** ${status.webappUrl}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error stopping test run: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }
- src/tools/testRuns.ts:227-229 (schema)The Zod input schema for the stop_test_run tool, validating the runId parameter.inputSchema: z.object({ runId: z.string().describe('Test run UUID to stop'), }).shape,
- src/tools/index.ts:5-33 (registration)Imports the testRuns tools module (including stopTestRunTool) and registers all tools with the MCP server, using the tool's name, description, schema, and handler.import * as testRunsTools from './testRuns.js'; import * as suitesTools from './suites.js'; import * as suiteRunsTools from './suiteRuns.js'; import * as profilesTools from './profiles.js'; import * as advancedTools from './advanced.js'; 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:242-244 (helper)The BugBugApiClient helper method that performs the HTTP POST request to the BugBug API endpoint to stop a test run.async stopTestRun(id: string): Promise<ApiResponse<BugBugTestRun>> { return this.makeRequest(`/testruns/${id}/stop/`, 'POST'); }