Skip to main content
Glama

get_pipeline_variable

Retrieve specific pipeline variable details from Bitbucket, including key, secured status, and value when accessible.

Instructions

Get details about a specific pipeline variable.

Args:
    repo_slug: Repository slug
    variable_uuid: Variable UUID (from list_pipeline_variables)

Returns:
    Variable details including key, secured status, and value (if not secured)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
variable_uuidYes

Implementation Reference

  • The main MCP tool handler function for 'get_pipeline_variable'. It uses the Bitbucket client to fetch the variable and formats the response using the PipelineVariableSummary model.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def get_pipeline_variable(repo_slug: str, variable_uuid: str) -> dict:
        """Get details about a specific pipeline variable.
    
        Args:
            repo_slug: Repository slug
            variable_uuid: Variable UUID (from list_pipeline_variables)
    
        Returns:
            Variable details including key, secured status, and value (if not secured)
        """
        client = get_client()
        result = client.get_pipeline_variable(repo_slug, variable_uuid)
        if not result:
            return not_found_response("Pipeline variable", variable_uuid)
    
        return PipelineVariableSummary.from_api(result).model_dump()
  • The BitbucketClient helper method that makes the actual API request to retrieve the pipeline variable by UUID.
    def get_pipeline_variable(
        self, repo_slug: str, variable_uuid: str
    ) -> Optional[dict[str, Any]]:
        """Get a specific pipeline variable.
    
        Args:
            repo_slug: Repository slug
            variable_uuid: Variable UUID
    
        Returns:
            Variable info or None if not found
        """
        variable_uuid = ensure_uuid_braces(variable_uuid)
        return self._request(
            "GET",
            self._repo_path(repo_slug, "pipelines_config", "variables", variable_uuid),
        )
  • Pydantic model used for input/output schema validation and serialization of pipeline variable data in the tool response.
    class PipelineVariableSummary(BaseModel):
        """Pipeline variable info."""
    
        uuid: str = ""
        key: str = ""
        secured: bool = False
        value: Optional[str] = None  # Only present for non-secured variables
    
        @classmethod
        def from_api(cls, data: dict) -> "PipelineVariableSummary":
            return cls(
                uuid=data.get("uuid", ""),
                key=data.get("key", ""),
                secured=data.get("secured", False),
                value=data.get("value"),  # Will be None for secured variables
            )

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