Skip to main content
Glama

get_environment

Retrieve deployment environment details including restrictions and variables from Bitbucket repositories to manage configurations and access controls.

Instructions

Get details about a specific deployment environment.

Args:
    repo_slug: Repository slug
    environment_uuid: Environment UUID (from list_environments)

Returns:
    Environment details including restrictions and variables

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
environment_uuidYes

Implementation Reference

  • Primary MCP tool handler for 'get_environment'. Decorated with @mcp.tool() for registration. Calls BitbucketClient.get_environment and formats the response dictionary.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def get_environment(repo_slug: str, environment_uuid: str) -> dict:
        """Get details about a specific deployment environment.
    
        Args:
            repo_slug: Repository slug
            environment_uuid: Environment UUID (from list_environments)
    
        Returns:
            Environment details including restrictions and variables
        """
        client = get_client()
        result = client.get_environment(repo_slug, environment_uuid)
        if not result:
            return not_found_response("Environment", environment_uuid)
    
        return {
            "uuid": result.get("uuid"),
            "name": result.get("name"),
            "environment_type": (result.get("environment_type") or {}).get("name"),
            "rank": result.get("rank"),
            "restrictions": result.get("restrictions"),
            "lock": result.get("lock"),
        }
  • BitbucketClient helper method that performs the HTTP GET request to retrieve specific environment details from the Bitbucket API.
    def get_environment(
        self, repo_slug: str, environment_uuid: str
    ) -> Optional[dict[str, Any]]:
        """Get deployment environment details.
    
        Args:
            repo_slug: Repository slug
            environment_uuid: Environment UUID
    
        Returns:
            Environment info or None if not found
        """
        environment_uuid = ensure_uuid_braces(environment_uuid)
        return self._request(
            "GET",
            self._repo_path(repo_slug, "environments", environment_uuid),
        )
  • Pydantic model defining the structure for environment information, used in related list_environments tool and matching the fields returned by get_environment.
    class EnvironmentSummary(BaseModel):
        """Environment info for list responses."""
    
        uuid: str
        name: str
        environment_type: Optional[str] = None
        rank: Optional[int] = None
    
        @classmethod
        def from_api(cls, data: dict) -> "EnvironmentSummary":
            return cls(
                uuid=data.get("uuid", ""),
                name=data.get("name", ""),
                environment_type=(data.get("environment_type") or {}).get("name"),
                rank=data.get("rank"),
            )

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/JaviMaligno/mcp-server-bitbucket'

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