env_group_list
List all environment groups with scopes, defaults, and environments for managing API testing configurations.
Instructions
Lista todos los grupos con sus scopes, default y entornos.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/environment.ts:524-544 (handler)The tool handler for 'env_group_list'. It registers the tool via server.tool(), calls storage.listGroups() to get all groups, and returns them as a JSON string. If no groups exist, returns a message indicating none are configured.
server.tool( 'env_group_list', 'Lista todos los grupos con sus scopes, default y entornos.', {}, async () => { try { const groups = await storage.listGroups() if (groups.length === 0) { return { content: [{ type: 'text' as const, text: 'No hay grupos configurados. Usa env_group_create para crear uno.' }], } } return { content: [{ type: 'text' as const, text: JSON.stringify(groups, 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/lib/storage.ts:403-410 (helper)The storage.listGroups() helper method. Reads all JSON files from the groups directory and returns them as EnvironmentGroup objects, filtering out null results.
async listGroups(): Promise<EnvironmentGroup[]> { await this.ensureDir('groups') const files = await this.listJsonFiles(this.groupsDir) const groups = await Promise.all( files.map((file) => this.readJson<EnvironmentGroup>(join(this.groupsDir, file))), ) return groups.filter((g): g is EnvironmentGroup => g !== null) } - src/lib/types.ts:82-88 (schema)The EnvironmentGroup interface defining the shape of group data returned by the tool: name, scopes, default environment, createdAt, and updatedAt.
export interface EnvironmentGroup { name: string scopes: string[] default?: string createdAt: string updatedAt: string } - src/tools/environment.ts:524-544 (registration)The tool is registered via server.tool() with the name 'env_group_list'. The registration is inside the registerEnvironmentTools() function defined in src/tools/environment.ts.
server.tool( 'env_group_list', 'Lista todos los grupos con sus scopes, default y entornos.', {}, async () => { try { const groups = await storage.listGroups() if (groups.length === 0) { return { content: [{ type: 'text' as const, text: 'No hay grupos configurados. Usa env_group_create para crear uno.' }], } } return { content: [{ type: 'text' as const, text: JSON.stringify(groups, null, 2) }], } } catch (error) { const message = error instanceof Error ? error.message : String(error) return { content: [{ type: 'text' as const, text: `Error: ${message}` }], isError: true } } }, )