bruno_run_request
Execute specific API requests from Bruno collections to test endpoints, manage environments, and generate test reports for validation and CI/CD integration.
Instructions
Run a specific request from a Bruno collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionPath | Yes | Path to the Bruno collection | |
| requestName | Yes | Name of the request to run | |
| environment | No | Name or path of the environment to use (optional) | |
| envVariables | No | Environment variables as key-value pairs (optional) | |
| reporterJson | No | Path to write JSON report (optional) | |
| reporterJunit | No | Path to write JUnit XML report for CI/CD integration (optional) | |
| reporterHtml | No | Path to write HTML report (optional) | |
| dryRun | No | Validate request configuration without executing HTTP call (optional) |
Implementation Reference
- Core execution logic for bruno_run_request tool: parses and validates input using Zod schema, performs security checks on paths and env vars, handles dry-run mode, executes Bruno CLI runRequest command, and returns formatted text response.async handle(args: unknown): Promise<ToolResponse> { const params = RunRequestSchema.parse(args); // Security validation const validation = await validateToolParameters({ collectionPath: params.collectionPath, requestName: params.requestName, envVariables: params.envVariables }); if (!validation.valid) { logSecurityEvent({ type: 'access_denied', details: `Run request blocked: ${validation.errors.join(', ')}`, severity: 'error' }); throw new McpError( ErrorCode.InvalidRequest, `Security validation failed: ${validation.errors.join(', ')}` ); } // Log warnings if any if (validation.warnings.length > 0) { validation.warnings.forEach(warning => { logSecurityEvent({ type: 'env_var_validation', details: warning, severity: 'warning' }); }); } // Handle dry run mode if (params.dryRun) { return await this.handleDryRun(params); } const result = await this.brunoCLI.runRequest( params.collectionPath, params.requestName, { environment: params.environment || params.enviroment, envVariables: params.envVariables, reporterJson: params.reporterJson, reporterJunit: params.reporterJunit, reporterHtml: params.reporterHtml } ); return { content: [ { type: 'text', text: this.formatter.format(result) } as TextContent ] }; }
- Zod validation schema for bruno_run_request tool parameters, used internally in the handler for runtime type checking.const RunRequestSchema = z.object({ collectionPath: z.string().describe('Path to the Bruno collection'), requestName: z.string().describe('Name of the request to run'), environment: z.string().optional().describe('Name or path of the environment to use'), enviroment: z.string().optional().describe('Alias for environment (to handle common typo)'), envVariables: z.record(z.string()).optional().describe('Environment variables as key-value pairs'), reporterJson: z.string().optional().describe('Path to write JSON report'), reporterJunit: z.string().optional().describe('Path to write JUnit XML report'), reporterHtml: z.string().optional().describe('Path to write HTML report'), dryRun: z.boolean().optional().describe('Validate request without executing HTTP call') });
- src/index.ts:30-76 (schema)Official MCP Tool schema definition for bruno_run_request, including name, description, inputSchema, and required parameters. Used by listTools request.{ name: 'bruno_run_request', description: 'Run a specific request from a Bruno collection', inputSchema: { type: 'object', properties: { collectionPath: { type: 'string', description: 'Path to the Bruno collection' }, requestName: { type: 'string', description: 'Name of the request to run' }, environment: { type: 'string', description: 'Name or path of the environment to use' }, enviroment: { type: 'string', description: 'Alias for environment (to handle common typo)' }, envVariables: { type: 'object', description: 'Environment variables as key-value pairs', additionalProperties: { type: 'string' } }, reporterJson: { type: 'string', description: 'Path to write JSON report' }, reporterJunit: { type: 'string', description: 'Path to write JUnit XML report' }, reporterHtml: { type: 'string', description: 'Path to write HTML report' }, dryRun: { type: 'boolean', description: 'Validate request without executing HTTP call' } }, required: ['collectionPath', 'requestName'] } },
- src/index.ts:289-289 (registration)Registers the RunRequestHandler instance with ToolRegistry, mapping 'bruno_run_request' (via getName()) to its execution handler.this.toolRegistry.register(new RunRequestHandler(this.brunoCLI));
- Handler's getName() method returning the tool identifier 'bruno_run_request' for registry lookup.getName(): string { return 'bruno_run_request'; }