get_environment_details
Retrieve detailed environment information and variables for API development workflows using environment ID.
Instructions
Get detailed environment information including variables
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environmentId | Yes | Environment ID to get details for | |
| includeVariables | No | Include environment variables in response |
Implementation Reference
- Main execution logic for the get_environment_details tool. Extracts environmentId from args, initializes BackendClient and EnvironmentService, fetches details, parses variables, formats a markdown response with environment info.export async function handleGetEnvironmentDetails(args: any): Promise<McpToolResponse> { try { const { environmentId, includeVariables } = args; if (!environmentId) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: 'Environment ID is required' }, null, 2) } ] }; } const instances = await getInstances(); // Create environment service const envService = new EnvironmentService( instances.backendClient.getBaseUrl(), instances.backendClient.getToken() ); // Get environment details const request: GetEnvironmentDetailsRequest = { environmentId, includeVariables: includeVariables !== false // default to true }; const response = await envService.getEnvironmentDetails(request); if (!response.success) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: response.error || 'Failed to get environment details' }, null, 2) } ] }; } const env = response.data; // Parse variables const variables = parseVariables(env.variables); // Format response let detailsText = `📋 Environment Details\n\n`; detailsText += `🏷️ Name: ${env.name}\n`; detailsText += `🆔 ID: ${env.id}\n`; detailsText += `📝 Description: ${env.description || 'No description'}\n`; detailsText += `🎯 Default: ${env.is_default ? 'Yes' : 'No'}\n`; detailsText += `📊 Variables: ${Object.keys(variables).length}\n\n`; if (Object.keys(variables).length > 0 && includeVariables !== false) { detailsText += `🔧 Variables:\n`; Object.entries(variables).forEach(([key, value], index) => { detailsText += ` ${index + 1}. ${key}: ${value}\n`; }); detailsText += '\n'; } else { detailsText += `🔧 No variables configured\n\n`; } detailsText += `📅 Created: ${env.created_at}\n`; detailsText += `🔄 Updated: ${env.updated_at}\n`; return { content: [ { type: 'text', text: detailsText } ] }; } catch (error: any) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: error.message || 'Unknown error occurred while getting environment details' }, null, 2) } ] }; } }
- src/tools/environment/tools.ts:37-56 (schema)MCP tool definition including name, description, and inputSchema for validating get_environment_details parameters.export const getEnvironmentDetailsTool: McpTool = { name: 'get_environment_details', description: 'Get detailed environment information including variables', inputSchema: { type: 'object', properties: { environmentId: { type: 'string', description: 'Environment ID to get details for' }, includeVariables: { type: 'boolean', description: 'Include environment variables in response', default: true } }, required: ['environmentId'] }, handler: handleGetEnvironmentDetails };
- src/tools/index.ts:89-92 (registration)Registers the get_environment_details tool handler in the central tool handlers map via dynamic import for lazy loading.'get_environment_details': async (args: any) => { const { handleGetEnvironmentDetails } = await import('./environment/handlers/detailsHandler.js'); return handleGetEnvironmentDetails(args); },
- src/tools/environment/types.ts:34-37 (schema)TypeScript interface defining the input parameters for get_environment_details request.export interface GetEnvironmentDetailsRequest { environmentId: string; includeVariables?: boolean; }
- src/tools/index.ts:30-38 (registration)Includes the get_environment_details tool (via environmentTools) in the complete list of available MCP tools for server registration.export const ALL_TOOLS: McpTool[] = [ ...CORE_TOOLS, ...AUTH_TOOLS, ...environmentTools, ...folderTools, ...ENDPOINT_TOOLS, ...testingTools, ...flowTools ];