Skip to main content
Glama

bruno_validate_environment

Validate environment files in Bruno collections to ensure proper configuration and prevent errors in API testing workflows.

Instructions

Validate an environment file in a Bruno collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionPathYesPath to the Bruno collection
environmentNameYesName of the environment to validate

Implementation Reference

  • Core handler function that parses input, validates parameters, executes BrunoCLI.validateEnvironment, formats output with status, masked variables, errors, and warnings, and returns MCP-formatted response.
    async handle(args: unknown): Promise<ToolResponse> {
      const params = ValidateEnvironmentSchema.parse(args);
    
      // Validate collection path and environment name
      const validation = await validateToolParameters({
        collectionPath: params.collectionPath,
        requestName: params.environmentName // Reuse request validation for env name
      });
    
      if (!validation.valid) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Invalid parameters: ${validation.errors.join(', ')}`
        );
      }
    
      try {
        const result = await this.brunoCLI.validateEnvironment(
          params.collectionPath,
          params.environmentName
        );
    
        const output: string[] = [];
        output.push(`=== Environment Validation: ${params.environmentName} ===`);
        output.push('');
    
        if (!result.exists) {
          output.push(`❌ Status: Not Found`);
          output.push('');
          output.push('Errors:');
          result.errors.forEach((err: string) => output.push(`  • ${err}`));
        } else if (!result.valid) {
          output.push(`❌ Status: Invalid`);
          output.push('');
          output.push('Errors:');
          result.errors.forEach((err: string) => output.push(`  • ${err}`));
        } else {
          output.push(`✅ Status: Valid`);
          output.push('');
    
          if (result.variables && Object.keys(result.variables).length > 0) {
            output.push(`Variables: ${Object.keys(result.variables).length}`);
            output.push('');
    
            Object.entries(result.variables).forEach(([key, value]) => {
              // Mask sensitive values
              const displayValue = key.toLowerCase().includes('password') ||
                                   key.toLowerCase().includes('secret') ||
                                   key.toLowerCase().includes('token') ||
                                   key.toLowerCase().includes('key')
                ? '*** (masked)'
                : value;
              output.push(`  ${key}: ${displayValue}`);
            });
            output.push('');
          }
        }
    
        if (result.warnings.length > 0) {
          output.push('Warnings:');
          result.warnings.forEach((warn: string) => output.push(`  ⚠️  ${warn}`));
        }
    
        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,
          `Failed to validate environment: ${maskedError}`
        );
      }
    }
  • Zod schema for validating the tool's input parameters: collectionPath and environmentName.
    const ValidateEnvironmentSchema = z.object({
      collectionPath: z.string().describe('Path to the Bruno collection'),
      environmentName: z.string().describe('Name of the environment to validate')
    });
  • src/index.ts:295-295 (registration)
    Registers the ValidateEnvironmentHandler instance with the ToolRegistry for tool execution dispatching.
    this.toolRegistry.register(new ValidateEnvironmentHandler(this.brunoCLI));
  • Tool definition in the TOOLS array including name, description, and inputSchema for MCP tool listing.
    {
      name: 'bruno_validate_environment',
      description: 'Validate an environment file in a Bruno collection',
      inputSchema: {
        type: 'object',
        properties: {
          collectionPath: {
            type: 'string',
            description: 'Path to the Bruno collection'
          },
          environmentName: {
            type: 'string',
            description: 'Name of the environment to validate'
          }
        },
        required: ['collectionPath', 'environmentName']
      }
  • src/index.ts:284-298 (registration)
    The registerToolHandlers method that instantiates and registers all tool handlers including ValidateEnvironmentHandler.
    private registerToolHandlers(): void {
      const container = getContainer();
      const perfManager = container.get<PerformanceManager>(ServiceKeys.PERFORMANCE_MANAGER);
    
      // Register all tool handlers
      this.toolRegistry.register(new RunRequestHandler(this.brunoCLI));
      this.toolRegistry.register(new RunCollectionHandler(this.brunoCLI));
      this.toolRegistry.register(new ListRequestsHandler(this.brunoCLI));
      this.toolRegistry.register(new HealthCheckHandler(this.brunoCLI, this.configLoader, perfManager));
      this.toolRegistry.register(new DiscoverCollectionsHandler(this.brunoCLI));
      this.toolRegistry.register(new ListEnvironmentsHandler(this.brunoCLI));
      this.toolRegistry.register(new ValidateEnvironmentHandler(this.brunoCLI));
      this.toolRegistry.register(new GetRequestDetailsHandler(this.brunoCLI));
      this.toolRegistry.register(new ValidateCollectionHandler(this.brunoCLI));
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('validate') but does not explain what validation entails (e.g., syntax checks, dependency verification, error reporting), the output format, or any side effects. This leaves significant gaps in understanding the tool's behavior.

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 purpose without unnecessary words. It is front-loaded and appropriately sized for a simple tool, making it easy to parse and understand quickly.

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 lack of annotations and output schema, the description is incomplete. It does not cover behavioral aspects like validation outcomes, error handling, or return values, which are crucial for a validation tool. The high schema coverage helps with parameters, but overall context is insufficient for effective agent 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?

The input schema has 100% description coverage, clearly documenting both parameters ('collectionPath' and 'environmentName') with their types and requirements. The description does not add any additional meaning beyond the schema, such as examples or constraints, so it meets the baseline for adequate but not enhanced parameter semantics.

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 ('validate') and the resource ('an environment file in a Bruno collection'), making the purpose understandable. However, it does not explicitly differentiate this tool from its sibling 'bruno_validate_collection', which validates the entire collection rather than a specific environment file, leaving room for potential confusion.

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, such as 'bruno_validate_collection' for broader validation or other environment-related tools. It lacks context on prerequisites, typical use cases, or exclusions, leaving the agent to infer usage from the tool name 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