project_environments
Retrieve and list all environments within a specified project on the Railway MCP server. Use the project ID to query and organize deployment environments efficiently.
Instructions
List all environments in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project |
Implementation Reference
- src/services/project.service.ts:107-132 (handler)Core handler logic that lists environments for a project using the client API, formats the response with details, and handles 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)}`); } }
- src/tools/project.tool.ts:109-118 (registration)Defines the project_environments tool: registers name, description, input schema (projectId), and thin handler delegating to projectService.createTool( "project_environments", "List all environments in a project", { projectId: z.string().describe("ID of the project") }, async ({projectId}) => { return projectService.listEnvironments(projectId); } )
- src/tools/project.tool.ts:112-114 (schema)Zod input schema requiring projectId string.{ projectId: z.string().describe("ID of the project") },
- src/tools/index.ts:16-37 (registration)Final registration of all tools including project_environments (via projectTools) with the MCP server using server.tool().export function registerAllTools(server: McpServer) { // Collect all tools const allTools = [ ...databaseTools, ...deploymentTools, ...domainTools, ...projectTools, ...serviceTools, ...tcpProxyTools, ...variableTools, ...configTools, ...volumeTools, ...templateTools, ] as Tool[]; // Register each tool with the server allTools.forEach((tool) => { server.tool( ...tool ); }); }