Skip to main content
Glama

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
NameRequiredDescriptionDefault
projectIdYesID of the project

Implementation Reference

  • 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); } )
  • Zod input schema for the project_environments tool, requiring a projectId string.
    { projectId: z.string().describe("ID of the project") },
  • 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)}`); } }

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