getEnvironments
Retrieve all configured environments in the Unleash Feature Toggle system to manage and audit feature flag settings across different contexts.
Instructions
Get a list of all environments configured in Unleash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get-environments.ts:6-46 (handler)The handler function that executes the getEnvironments tool logic: fetches all environments using getAllEnvironments and formats the response as JSON.async function handleGetEnvironments() { try { // Get all environments const environments = await getAllEnvironments(); if (!environments) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: "Failed to fetch environments" }, null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify({ success: true, count: environments.length, environments: environments }, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: error.message }, null, 2) }], isError: true }; } }
- src/tools/get-environments.ts:51-55 (schema)Tool schema definition with name, description, and reference to the handler function.export const getEnvironments = { name: "getEnvironments", description: "Get a list of all environments configured in Unleash", handler: handleGetEnvironments };
- src/server.ts:189-193 (registration)Registration of the getEnvironments tool on the MCP server.server.tool( getEnvironments.name, getEnvironments.description, getEnvironments.handler as any );