Skip to main content
Glama
Kallows

MCP Bitbucket Python

by Kallows

bb_delete_file

Remove files from a Bitbucket repository using a commit, specifying workspace, repo slug, file path, and branch. Streamline file deletion with automated commit messages.

Instructions

Delete a file from a Bitbucket repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchNoBranch name (defaults to main/master)main
messageNoCommit message for the deletionDelete file via MCP
pathYesPath to the file to delete
repo_slugYesRepository slug/name
workspaceNoRepository workspace (defaults to kallows)kallows

Implementation Reference

  • Handler logic for bb_delete_file tool: deletes file by posting empty content to Bitbucket src endpoint.
    elif name == "bb_delete_file":
        workspace = arguments.get("workspace", "kallows")
        repo_slug = arguments.get("repo_slug")
        file_path = arguments.get("path")
        message = arguments.get("message", "Delete file via MCP")
        branch = arguments.get("branch", "main")
    
        url = f"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/src"
        
        # In Bitbucket, file deletion is done by posting an empty file
        files = {
            file_path: (None, "")
        }
        data = {
            'message': message,
            'branch': branch
        }
    
        response = requests.post(url, auth=auth, files=files, data=data)
    
        if response.status_code in (200, 201):
            return [types.TextContent(
                type="text",
                text=f"File {file_path} deleted successfully"
            )]
        else:
            return [types.TextContent(
                type="text",
                text=f"Failed to delete file: {response.status_code}\n{format_permission_error(response.text)}",
                isError=True
            )]
  • Registration of bb_delete_file tool in list_tools(), including input schema.
    types.Tool(
        name="bb_delete_file",
        description="Delete a file from a Bitbucket repository",
        inputSchema={
            "type": "object",
            "properties": {
                "workspace": {
                    "type": "string",
                    "description": "Repository workspace (defaults to kallows)",
                    "default": "kallows"
                },
                "repo_slug": {
                    "type": "string",
                    "description": "Repository slug/name"
                },
                "path": {
                    "type": "string",
                    "description": "Path to the file to delete"
                },
                "message": {
                    "type": "string",
                    "description": "Commit message for the deletion",
                    "default": "Delete file via MCP"
                },
                "branch": {
                    "type": "string",
                    "description": "Branch name (defaults to main/master)",
                    "default": "main"
                }
            },
            "required": ["repo_slug", "path"]
        }
    ),
Install Server

Other Tools

Related Tools

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

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