Skip to main content
Glama

bruno_run_request

Execute API requests from Bruno collections with environment variables and generate test reports in JSON, JUnit, or HTML formats.

Instructions

Run a specific request from a Bruno collection

Input Schema

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

Implementation Reference

  • The RunRequestHandler class implements IToolHandler for the bruno_run_request tool. It validates parameters, performs security checks, executes the request via BrunoCLI.runRequest or handles dry-run mode, and formats the output.
    export class RunRequestHandler 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_request';
      }
    
      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
          ]
        };
      }
    
      private async handleDryRun(params: RunRequestParams): Promise<ToolResponse> {
        try {
          // Get request details to validate structure
          const details = await this.brunoCLI.getRequestDetails(
            params.collectionPath,
            params.requestName
          );
    
          const output: string[] = [];
          output.push('=== DRY RUN: Request Validation ===');
          output.push('');
          output.push(`✅ Request validated successfully (HTTP call not executed)`);
          output.push('');
          output.push(`Request: ${details.name}`);
          output.push(`Method: ${details.method}`);
          output.push(`URL: ${details.url}`);
          output.push('');
    
          // Show what would be executed
          output.push('Configuration Summary:');
          output.push(`  Headers: ${Object.keys(details.headers).length}`);
          output.push(`  Body: ${details.body ? details.body.type : 'none'}`);
          output.push(`  Auth: ${details.auth}`);
          output.push(`  Tests: ${details.tests?.length || 0}`);
          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 request was sent.');
          output.push('   Remove dryRun parameter to execute the actual request.');
    
          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 (RunRequestSchema) used in the handler to parse and validate input parameters for the bruno_run_request tool.
    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:289-289 (registration)
    Instantiation and registration of RunRequestHandler with the ToolRegistry in BrunoMCPServer.registerToolHandlers().
    this.toolRegistry.register(new RunRequestHandler(this.brunoCLI));
  • src/index.ts:30-76 (registration)
    Tool definition in the TOOLS array, including name, description, and JSON inputSchema for MCP protocol listing.
    {
      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']
      }
    },
  • JSON Schema in the tool definition used by MCP server for input validation and tool listing.
    {
      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']
      }
    },
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 but offers minimal information. It states the tool runs a request but doesn't describe what 'run' entails (e.g., executing an HTTP call, returning response data, handling errors), whether it's read-only or mutative, or any side effects like report generation. This leaves critical behavioral traits unspecified for a tool with execution capabilities.

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, direct sentence that efficiently conveys the core function without unnecessary words. It's front-loaded with the essential action and target, making it easy to parse. Every part of the sentence earns its place by specifying what is being run and from where.

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?

Given the tool's complexity (9 parameters, execution behavior, no output schema, and no annotations), the description is insufficient. It lacks details on what 'run' returns (e.g., HTTP response, status codes), error handling, or how parameters like 'dryRun' or reporters affect behavior. For a tool that likely performs network operations and generates outputs, more context is needed to guide effective use.

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%, providing clear documentation for all 9 parameters. The description adds no parameter-specific information beyond implying 'run' involves the 'collectionPath' and 'requestName'. Since the schema already fully describes parameters, the baseline score of 3 is appropriate—the description doesn't enhance parameter understanding but doesn't need to compensate for gaps.

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') and target ('a specific request from a Bruno collection'), making the purpose immediately understandable. It distinguishes this tool from siblings like 'bruno_run_collection' (which runs entire collections) and 'bruno_get_request_details' (which inspects rather than executes). However, it doesn't explicitly contrast with all siblings like 'bruno_validate_collection', leaving some room for improvement.

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. It doesn't mention prerequisites (e.g., needing a valid collection path), contrast with 'bruno_run_collection' for batch execution, or indicate scenarios where running a single request is preferable. The agent must infer usage from the tool name and parameters alone.

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