project_environments
Retrieve all environment configurations for a specific project to manage deployment settings and variables.
Instructions
List all environments in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project |
Implementation Reference
- src/tools/project.tool.ts:109-118 (handler)The createTool call defining the 'project_environments' tool, including its input schema, description, and handler function that invokes projectService.listEnvironments(projectId).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 for the project_environments tool, requiring a projectId string.{ projectId: z.string().describe("ID of the project") },
- src/tools/index.ts:16-37 (registration)Registration of all tools, including project_environments from projectTools, using server.tool for each.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 ); }); }
- The listEnvironments method in ProjectService that performs the actual API call to list project environments and formats the response.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)}`); } }