Skip to main content
Glama

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
NameRequiredDescriptionDefault
environmentIdYesEnvironment ID to get details for
includeVariablesNoInclude 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) } ] }; } }
  • 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 };
  • 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); },
  • TypeScript interface defining the input parameters for get_environment_details request.
    export interface GetEnvironmentDetailsRequest { environmentId: string; includeVariables?: boolean; }
  • 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 ];

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/martin-1103/mcp2'

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