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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/environment.ts:87-118 (handler)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, } } }, ) - src/tools/environment.ts:91-91 (schema)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) - src/lib/storage.ts:122-148 (helper)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, })) } - src/lib/types.ts:71-78 (schema)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 }