Skip to main content
Glama

env_list

Lists all available environments and indicates which one is active for API testing.

Instructions

Lista todos los entornos disponibles e indica cuál está activo.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'env_list' tool. Calls storage.listEnvironments() and returns the list as JSON. Registered via server.tool('env_list', ...) inside registerEnvironmentTools.
    // ── env_list ──
    server.tool(
      'env_list',
      'Lista todos los entornos disponibles e indica cuál está activo.',
      {},
      async () => {
        try {
          const items = await storage.listEnvironments()
    
          if (items.length === 0) {
            return {
              content: [{ type: 'text' as const, text: 'No hay entornos configurados' }],
            }
          }
    
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(items, null, 2),
              },
            ],
          }
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error)
          return {
            content: [{ type: 'text' as const, text: `Error: ${message}` }],
            isError: true,
          }
        }
      },
    )
  • Input schema for env_list - empty object {} since no parameters are needed.
    {},
  • src/server.ts:64-64 (registration)
    Registration of the environment tools (including env_list) via registerEnvironmentTools(server, storage) in createServer().
    registerEnvironmentTools(server, storage)
  • Helper method listEnvironments() on the Storage class. Reads all environment JSON files, filters by CWD group scope, and returns EnvironmentListItem[] with active/default flags.
    async listEnvironments(): Promise<EnvironmentListItem[]> {
      await this.ensureDir('environments')
      const files = await this.listJsonFiles(this.environmentsDir)
      const activeEnv = await this.getActiveEnvironment()
    
      // Detectar grupo del CWD para filtrar
      const cwdGroup = await this.getGroupForPath(process.cwd())
    
      const allEnvs = await Promise.all(
        files.map((file) => this.readJson<Environment>(join(this.environmentsDir, file))),
      )
    
      // Filtrar: si hay grupo para el CWD, mostrar entornos de ese grupo + globales
      // Si no hay grupo, mostrar todos
      const filtered = allEnvs
        .filter((env): env is Environment => env !== null)
        .filter((env) => cwdGroup ? (env.group === cwdGroup.name || !env.group) : true)
    
      return filtered.map((env) => ({
        name: env.name,
        active: env.name === activeEnv,
        default: cwdGroup ? cwdGroup.default === env.name : false,
        group: env.group,
        variableCount: Object.keys(env.variables).length,
        spec: env.spec,
      }))
    }
  • Type definition for EnvironmentListItem returned by env_list, containing name, active, default, group, variableCount, and spec fields.
    export interface EnvironmentListItem {
      name: string
      active: boolean
      default: boolean
      group?: string
      variableCount: number
      spec?: string
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It correctly describes a read-only operation listing environments, but adds no extra behavioral details like authentication or side effects.

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?

Single sentence, concise, and immediately conveys the purpose. No wasted words.

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

Completeness5/5

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

Sufficient for a simple list tool with no parameters. No output schema needed; the description covers the core functionality.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters in the schema (100% coverage), so description doesn't need to compensate. Baseline score of 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and resource 'environments', and specifies it indicates the active one. It distinguishes itself from sibling tools like env_create or env_delete.

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 on when to use this tool versus alternatives like env_list or env_spec. The description only states what it does, not context or exclusions.

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/cocaxcode/api-testing-mcp'

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