Skip to main content
Glama

create_tag

Create a new tag in a Bitbucket repository to mark specific commits or branches with version labels like v1.0.0, supporting optional annotated tag messages.

Instructions

Create a new tag in a repository.

Args: repo_slug: Repository slug name: Tag name (e.g., "v1.0.0") target: Commit hash or branch name to tag message: Optional tag message (for annotated tags) Returns: Created tag info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
nameYes
targetYes
messageNo

Implementation Reference

  • MCP tool handler function for create_tag, decorated with @mcp.tool(). Calls the Bitbucket client to create the tag and formats the response.
    @mcp.tool() @handle_bitbucket_error @formatted def create_tag( repo_slug: str, name: str, target: str, message: str = "", ) -> dict: """Create a new tag in a repository. Args: repo_slug: Repository slug name: Tag name (e.g., "v1.0.0") target: Commit hash or branch name to tag message: Optional tag message (for annotated tags) Returns: Created tag info """ client = get_client() result = client.create_tag( repo_slug, name=name, target=target, message=message if message else None, ) return { "name": result.get("name"), "target": truncate_hash(result.get("target", {}).get("hash")), "message": result.get("message", ""), }
  • BitbucketClient method that implements the actual API call to create a tag in the repository.
    def create_tag( self, repo_slug: str, name: str, target: str, message: Optional[str] = None, ) -> dict[str, Any]: """Create a tag. Args: repo_slug: Repository slug name: Tag name (e.g., "v1.0.0") target: Commit hash or branch to tag message: Optional tag message (for annotated tags) Returns: Created tag info """ payload = { "name": name, "target": {"hash": target}, } if message: payload["message"] = message result = self._request( "POST", self._repo_path(repo_slug, "refs", "tags"), json=payload, ) return self._require_result(result, "create tag", name)

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