Skip to main content
Glama

project_environments

Retrieve all environments for a specific project to manage deployment configurations and variables across different stages.

Instructions

List all environments in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesID of the project

Implementation Reference

  • Executes the core logic for listing project environments: queries the Railway API client, formats detailed environment information (name, ID, creation date, ephemeral status, unmerged changes), handles empty results and errors.
      async listEnvironments(projectId: string) {
        try {
          const environments = await this.client.projects.listEnvironments(projectId);
    
          if (environments.length === 0) {
            return createSuccessResponse({
              text: "No environments found in this project.",
              data: []
            });
          }
    
          const environmentDetails = environments.map(env => 
            `🌍 ${env.name} (ID: ${env.id})
    Created: ${new Date(env.createdAt).toLocaleString()}
    ${env.isEphemeral ? '(Ephemeral)' : '(Permanent)'}
    ${env.unmergedChangesCount ? `Unmerged Changes: ${env.unmergedChangesCount}` : ''}`
          );
    
          return createSuccessResponse({
            text: `Environments in project:\n\n${environmentDetails.join('\n\n')}`,
            data: environments
          });
        } catch (error) {
          return createErrorResponse(`Error listing environments: ${formatError(error)}`);
        }
      }
  • Registers the 'project_environments' tool with description, input schema requiring projectId, and handler that delegates to projectService.listEnvironments.
    createTool(
      "project_environments",
      "List all environments in a project",
      {
        projectId: z.string().describe("ID of the project")
      },
      async ({projectId}) => {
        return projectService.listEnvironments(projectId);
      }
    )
  • Zod schema defining the required 'projectId' string input parameter.
      projectId: z.string().describe("ID of the project")
    },

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/epitaphe360/railway-mcp'

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