Skip to main content
Glama

bruno_run_collection

Execute all API requests in a Bruno collection or specific folder to test endpoints, generate reports, and validate collection structure.

Instructions

Run all requests in a Bruno collection or specific folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionPathYesPath to the Bruno collection
environmentNoName or path of the environment to use
enviromentNoAlias for environment (to handle common typo)
folderPathNoSpecific folder within collection to run
envVariablesNoEnvironment variables as key-value pairs
reporterJsonNoPath to write JSON report
reporterJunitNoPath to write JUnit XML report
reporterHtmlNoPath to write HTML report
dryRunNoValidate requests without executing HTTP calls

Implementation Reference

  • RunCollectionHandler class implementing IToolHandler interface for the bruno_run_collection tool. Contains the main handle() method and dry-run logic.
    export class RunCollectionHandler implements IToolHandler {
      private readonly brunoCLI: IBrunoCLI;
      private readonly formatter: RunResultFormatter;
    
      constructor(brunoCLI: IBrunoCLI) {
        this.brunoCLI = brunoCLI;
        this.formatter = new RunResultFormatter();
      }
    
      getName(): string {
        return 'bruno_run_collection';
      }
    
      async handle(args: unknown): Promise<ToolResponse> {
        const params = RunCollectionSchema.parse(args);
    
        // Security validation
        const validation = await validateToolParameters({
          collectionPath: params.collectionPath,
          folderPath: params.folderPath,
          envVariables: params.envVariables
        });
    
        if (!validation.valid) {
          logSecurityEvent({
            type: 'access_denied',
            details: `Run collection 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.runCollection(
          params.collectionPath,
          {
            environment: params.environment || params.enviroment,
            folderPath: params.folderPath,
            envVariables: params.envVariables,
            reporterJson: params.reporterJson,
            reporterJunit: params.reporterJunit,
            reporterHtml: params.reporterHtml
          }
        );
    
        return {
          content: [
            {
              type: 'text',
              text: this.formatter.format(result)
            } as TextContent
          ]
        };
      }
    
      private async handleDryRun(params: RunCollectionParams): Promise<ToolResponse> {
        try {
          // List all requests in the collection/folder
          const requests = await this.brunoCLI.listRequests(params.collectionPath);
    
          // Filter by folder if specified
          let requestsToValidate = requests;
          if (params.folderPath) {
            requestsToValidate = requests.filter(req =>
              req.folder && params.folderPath && req.folder.includes(params.folderPath)
            );
          }
    
          const output: string[] = [];
          output.push('=== DRY RUN: Collection Validation ===');
          output.push('');
          output.push(`✅ Collection validated successfully (HTTP calls not executed)`);
          output.push('');
          output.push(`Total Requests: ${requestsToValidate.length}`);
          output.push('');
    
          // Validate each request
          output.push('Requests that would be executed:');
          for (const req of requestsToValidate) {
            try {
              const details = await this.brunoCLI.getRequestDetails(
                params.collectionPath,
                req.name
              );
              output.push(`  ✓ ${req.name} - ${details.method} ${details.url}`);
            } catch (error) {
              output.push(`  ✗ ${req.name} - Validation error: ${error}`);
            }
          }
          output.push('');
    
          if (params.folderPath) {
            output.push(`Folder Filter: ${params.folderPath}`);
            output.push('');
          }
    
          if (params.environment) {
            output.push(`Environment: ${params.environment}`);
            output.push('');
          }
    
          if (params.envVariables && Object.keys(params.envVariables).length > 0) {
            output.push(`Environment Variables: ${Object.keys(params.envVariables).length} provided`);
            output.push('');
          }
    
          output.push('ℹ️  This was a dry run - no HTTP requests were sent.');
          output.push('   Remove dryRun parameter to execute the actual collection.');
    
          return {
            content: [
              {
                type: 'text',
                text: output.join('\n')
              } as TextContent
            ]
          };
        } catch (error) {
          const maskedError = error instanceof Error ? maskSecretsInError(error) : error;
          throw new McpError(
            ErrorCode.InternalError,
            `Dry run validation failed: ${maskedError}`
          );
        }
      }
    }
  • Zod schema (RunCollectionSchema) used for input validation in the handler.
    const RunCollectionSchema = z.object({
      collectionPath: z.string().describe('Path to the Bruno collection'),
      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)'),
      folderPath: z.string().optional().describe('Specific folder within collection to run'),
      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 requests without executing HTTP calls')
    });
  • MCP tool definition in TOOLS array, providing name, description, and inputSchema for bruno_run_collection.
    {
      name: 'bruno_run_collection',
      description: 'Run all requests in a Bruno collection or specific folder',
      inputSchema: {
        type: 'object',
        properties: {
          collectionPath: {
            type: 'string',
            description: 'Path to the Bruno collection'
          },
          environment: {
            type: 'string',
            description: 'Name or path of the environment to use'
          },
          enviroment: {
            type: 'string',
            description: 'Alias for environment (to handle common typo)'
          },
          folderPath: {
            type: 'string',
            description: 'Specific folder within collection to run'
          },
          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 requests without executing HTTP calls'
          }
        },
        required: ['collectionPath']
      }
    },
  • src/index.ts:290-290 (registration)
    Registration of RunCollectionHandler instance in ToolRegistry during server initialization.
    this.toolRegistry.register(new RunCollectionHandler(this.brunoCLI));
  • src/index.ts:23-23 (registration)
    Import statement for RunCollectionHandler used in registration.
    import { RunCollectionHandler } from './tools/handlers/RunCollectionHandler.js';
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Run all requests' implies execution of HTTP calls, the description doesn't mention important behavioral aspects like whether this is a destructive operation, what happens on failures, whether it runs requests sequentially or in parallel, authentication requirements, or rate limits. The 'dryRun' parameter hints at validation capability but this isn't explained in the description.

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 clearly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded with the core functionality.

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

Completeness2/5

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

For a tool with 9 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns (success/failure indicators, execution results), how errors are handled, or the relationship between collection execution and the various reporter parameters. The complexity of the tool warrants more comprehensive description.

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?

With 100% schema description coverage, the baseline is 3. The description adds no additional parameter semantics beyond what's already documented in the schema. It mentions 'specific folder' which corresponds to the 'folderPath' parameter, but provides no extra context about parameter usage or relationships.

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 ('Run all requests') and the target ('in a Bruno collection or specific folder'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from its sibling 'bruno_run_request' which runs individual requests rather than collections/folders.

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?

The description provides no guidance on when to use this tool versus alternatives like 'bruno_run_request' for single requests or 'bruno_validate_collection' for validation. It mentions the option to run specific folders but doesn't explain when that would be preferable to running the entire collection.

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/jcr82/bruno-mcp-server'

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