Skip to main content
Glama

bruno_list_environments

Retrieve all available environments from a Bruno API collection to manage configuration variables for testing different endpoints and scenarios.

Instructions

List all environments in a Bruno collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionPathYesPath to the Bruno collection

Implementation Reference

  • Core handler logic for bruno_list_environments: parses input, validates collection path, lists environments via BrunoCLI, formats output with previews (secrets masked), handles errors.
    async handle(args: unknown): Promise<ToolResponse> {
      const params = ListEnvironmentsSchema.parse(args);
    
      // Validate collection path
      const validation = await validateToolParameters({
        collectionPath: params.collectionPath
      });
    
      if (!validation.valid) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Invalid collection path: ${validation.errors.join(', ')}`
        );
      }
    
      try {
        const environments = await this.brunoCLI.listEnvironments(params.collectionPath);
    
        const output: string[] = [];
    
        if (environments.length === 0) {
          output.push('No environments found in this collection.');
          output.push('');
          output.push('Environments are stored in the "environments" directory with .bru extension.');
        } else {
          output.push(`Found ${environments.length} environment(s):\n`);
    
          environments.forEach((env) => {
            output.push(`• ${env.name}`);
            output.push(`  Path: ${env.path}`);
    
            if (env.variables && Object.keys(env.variables).length > 0) {
              output.push(`  Variables: ${Object.keys(env.variables).length}`);
    
              // Show first few variables as preview
              const varEntries = Object.entries(env.variables).slice(0, 3);
              varEntries.forEach(([key, value]) => {
                // Mask potential secrets in output
                const displayValue = key.toLowerCase().includes('password') ||
                                     key.toLowerCase().includes('secret') ||
                                     key.toLowerCase().includes('token') ||
                                     key.toLowerCase().includes('key')
                  ? '***'
                  : value.length > 50 ? value.substring(0, 47) + '...' : value;
                output.push(`    - ${key}: ${displayValue}`);
              });
    
              if (Object.keys(env.variables).length > 3) {
                output.push(`    ... and ${Object.keys(env.variables).length - 3} more`);
              }
            }
    
            output.push('');
          });
        }
    
        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 list environments: ${maskedError}`
        );
      }
    }
  • Zod schema for input validation in the handler.
    const ListEnvironmentsSchema = z.object({
      collectionPath: z.string().describe('Path to the Bruno collection')
    });
  • MCP tool inputSchema definition provided in ListTools response.
    inputSchema: {
      type: 'object',
      properties: {
        collectionPath: {
          type: 'string',
          description: 'Path to the Bruno collection'
        }
      },
      required: ['collectionPath']
    }
  • src/index.ts:294-294 (registration)
    Registers the ListEnvironmentsHandler instance with the ToolRegistry for execution.
    this.toolRegistry.register(new ListEnvironmentsHandler(this.brunoCLI));
  • src/index.ts:173-186 (registration)
    Tool definition registered in the TOOLS array for ListTools request.
    {
      name: 'bruno_list_environments',
      description: 'List all environments in a Bruno collection',
      inputSchema: {
        type: 'object',
        properties: {
          collectionPath: {
            type: 'string',
            description: 'Path to the Bruno collection'
          }
        },
        required: ['collectionPath']
      }
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes a read operation ('List'), implying it's non-destructive, but doesn't specify if it requires authentication, has rate limits, or details the return format (e.g., list structure, error handling). This leaves gaps in understanding how the tool behaves beyond its basic function.

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, clear sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to understand quickly. Every part of the sentence contributes directly to the tool's purpose.

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

Completeness3/5

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

Given the tool's low complexity (single parameter, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on usage context, behavioral traits, or output. For a simple list tool, this might suffice, but it doesn't provide a complete picture for optimal 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?

Schema description coverage is 100%, so the input schema already documents the 'collectionPath' parameter fully. The description doesn't add any extra meaning about parameters beyond what the schema provides, such as format examples or constraints. This meets the baseline for high schema coverage.

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 ('List') and resource ('environments in a Bruno collection'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'bruno_discover_collections' or 'bruno_list_requests', which would require mentioning it specifically lists environments rather than collections or requests.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing a valid collection path, or compare it to siblings like 'bruno_validate_environment' for environment validation. The description only states what it does, not when to use it.

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