Skip to main content
Glama

create_pipeline_variable

Add secure or plain-text configuration variables to Bitbucket pipelines for managing secrets and environment settings.

Instructions

Create a pipeline variable.

Args:
    repo_slug: Repository slug
    key: Variable name (e.g., "PYPI_TOKEN", "AWS_SECRET_KEY")
    value: Variable value
    secured: Whether to encrypt the value (default: False).
             Secured variables cannot be read back from the API.

Returns:
    Created variable info with UUID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
keyYes
valueYes
securedNo

Implementation Reference

  • MCP tool handler for create_pipeline_variable. This is the main execution function decorated with @mcp.tool(), which handles the tool call, gets the Bitbucket client, calls the underlying client method, and returns formatted response.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def create_pipeline_variable(
        repo_slug: str,
        key: str,
        value: str,
        secured: bool = False,
    ) -> dict:
        """Create a pipeline variable.
    
        Args:
            repo_slug: Repository slug
            key: Variable name (e.g., "PYPI_TOKEN", "AWS_SECRET_KEY")
            value: Variable value
            secured: Whether to encrypt the value (default: False).
                     Secured variables cannot be read back from the API.
    
        Returns:
            Created variable info with UUID
        """
        client = get_client()
        result = client.create_pipeline_variable(repo_slug, key, value, secured)
        return {
            "uuid": result.get("uuid"),
            "key": result.get("key"),
            "secured": result.get("secured"),
        }
  • Helper method in BitbucketClient that performs the actual Bitbucket API POST request to create the pipeline variable.
    def create_pipeline_variable(
        self,
        repo_slug: str,
        key: str,
        value: str,
        secured: bool = False,
    ) -> dict[str, Any]:
        """Create a pipeline variable.
    
        Args:
            repo_slug: Repository slug
            key: Variable name (e.g., "PYPI_TOKEN")
            value: Variable value
            secured: Whether to encrypt the value (default: False)
    
        Returns:
            Created variable info
        """
        payload = {"key": key, "value": value, "secured": secured}
        result = self._request(
            "POST",
            self._repo_path(repo_slug, "pipelines_config", "variables") + "/",
            json=payload,
        )
        return self._require_result(result, "create pipeline variable")
  • src/server.py:530-530 (registration)
    The @mcp.tool() decorator registers the create_pipeline_variable function as an MCP tool.
    @mcp.tool()

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