Skip to main content
Glama
Kallows

MCP Bitbucket Python

by Kallows

bb_create_pull_request

Create a pull request in a Bitbucket repository, specifying source and destination branches, title, and description, with optional source branch closure after merging.

Instructions

Create a new pull request in a Bitbucket repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
close_source_branchNoClose source branch after merge
descriptionNoPull request description
destination_branchNoBranch you want to merge intomain
repo_slugYesRepository slug/name
source_branchYesBranch containing your changes
titleYesPull request title
workspaceNoRepository workspace (defaults to kallows)kallows

Implementation Reference

  • Handler function for bb_create_pull_request tool. Creates a pull request in Bitbucket using the Bitbucket API by posting to the pullrequests endpoint with the provided title, description, source and destination branches.
    elif name == "bb_create_pull_request":
        workspace = arguments.get("workspace", "kallows")
        repo_slug = arguments.get("repo_slug")
        title = arguments.get("title")
        description = arguments.get("description", "")
        source_branch = arguments.get("source_branch")
        destination_branch = arguments.get("destination_branch", "main")
        close_source_branch = arguments.get("close_source_branch", True)
    
        url = f"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests"
        
        payload = {
            "title": title,
            "description": description,
            "source": {
                "branch": {
                    "name": source_branch
                }
            },
            "destination": {
                "branch": {
                    "name": destination_branch
                }
            },
            "close_source_branch": close_source_branch
        }
    
        response = requests.post(url, json=payload, auth=auth, headers=headers)
    
        if response.status_code in (200, 201):
            pr_id = response.json().get('id')
            pr_url = response.json().get('links', {}).get('html', {}).get('href', '')
            return [types.TextContent(
                type="text",
                text=f"Pull request created successfully\nID: {pr_id}\nURL: {pr_url}"
            )]
        else:
            return [types.TextContent(
                type="text",
                text=f"Failed to create pull request: {response.status_code}\n{format_permission_error(response.text)}",
                isError=True
            )]
  • Tool registration for bb_create_pull_request, including name, description, and input schema definition.
    types.Tool(
        name="bb_create_pull_request",
        description="Create a new pull request in 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"
                },
                "title": {
                    "type": "string",
                    "description": "Pull request title"
                },
                "description": {
                    "type": "string",
                    "description": "Pull request description"
                },
                "source_branch": {
                    "type": "string",
                    "description": "Branch containing your changes"
                },
                "destination_branch": {
                    "type": "string",
                    "description": "Branch you want to merge into",
                    "default": "main"
                },
                "close_source_branch": {
                    "type": "boolean",
                    "description": "Close source branch after merge",
                    "default": True
                }
            },
            "required": ["repo_slug", "title", "source_branch"]
        }
    )                
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a pull request but doesn't describe what happens upon invocation (e.g., whether it opens a draft, requires approvals, triggers notifications, or has side effects like branch locking). For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every part of the sentence earns its place by conveying essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 7 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like error conditions, permissions needed, or what the tool returns. Given the complexity and lack of structured data, the description should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter-specific information beyond what the input schema already provides. Since schema description coverage is 100%, the baseline score is 3. The description doesn't explain parameter interactions, dependencies, or provide examples, so it doesn't compensate for any schema gaps (though none exist).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new pull request') and resource ('in a Bitbucket repository'), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like 'bb_create_issue' or 'bb_create_branch' beyond mentioning 'pull request', leaving some room for confusion about when to use each creation tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing existing branches), exclusions, or compare it to sibling tools like 'bb_create_issue' for different types of requests. Usage is implied by the name but not explicitly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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