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
| Name | Required | Description | Default |
|---|---|---|---|
| repo_slug | Yes | ||
| environment_uuid | Yes |
Implementation Reference
- src/server.py:1114-1140 (handler)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"), }
- src/bitbucket_client.py:1114-1130 (helper)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), )
- src/models.py:487-502 (schema)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"), )