Skip to main content
Glama
martin-1103
by martin-1103

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
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It implies a read-only operation ('Get') but doesn't specify permissions, rate limits, response format, or error handling. This is inadequate for a tool with potential complexity in environment details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It front-loads the core purpose ('Get detailed environment information') and includes a key detail ('including variables') without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what 'detailed environment information' entails beyond variables, how results are structured, or potential limitations. For a tool that might return complex data, this leaves significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the input schema fully documents both parameters. The description adds no additional meaning beyond implying that 'environment variables' are part of the details, which aligns with the schema's 'includeVariables' parameter. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('detailed environment information including variables'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_endpoint_details' or 'get_flow_details' beyond the resource type, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context (e.g., after creating an environment), or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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