Skip to main content
Glama
Kallows

MCP Bitbucket Python

by Kallows

bb_read_file

Retrieve and access files directly from a Bitbucket repository using workspace, repo slug, path, and branch inputs. Simplifies file operations for repository management tasks.

Instructions

Read a file from a Bitbucket repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchNoBranch name (defaults to main/master)main
pathYesPath to the file in the repository
repo_slugYesRepository slug/name
workspaceNoRepository workspace (defaults to kallows)kallows

Implementation Reference

  • Handler implementation for the 'bb_read_file' tool. Fetches file content from Bitbucket repository using API GET request to /src/{branch}/{path} endpoint and returns the raw text content or error message.
    elif name == "bb_read_file":
        workspace = arguments.get("workspace", "kallows")
        repo_slug = arguments.get("repo_slug")
        file_path = arguments.get("path")
        branch = arguments.get("branch", "main")
    
        url = f"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/src/{branch}/{file_path}"
        response = requests.get(url, auth=auth)
    
        if response.status_code == 200:
            return [types.TextContent(
                type="text",
                text=response.text
            )]
        else:
            return [types.TextContent(
                type="text",
                text=f"Failed to read file: {response.status_code}\n{format_permission_error(response.text)}",
                isError=True
            )]
  • Tool registration in list_tools() handler, defining the name, description, and input schema for 'bb_read_file'.
    types.Tool(
        name="bb_read_file",
        description="Read 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 in the repository"
                },
                "branch": {
                    "type": "string",
                    "description": "Branch name (defaults to main/master)",
                    "default": "main"
                }
            },
            "required": ["repo_slug", "path"]
        }
    ),
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 action ('Read a file') but lacks details on permissions, error handling, rate limits, or output format. This is insufficient for a tool that interacts with a repository system, leaving the agent with 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, clear sentence with no wasted words. It is front-loaded with the core action and resource, making it highly efficient and easy to parse.

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?

Given the complexity of a file-reading tool with no annotations and no output schema, the description is incomplete. It does not explain what the tool returns (e.g., file content, metadata), error conditions, or dependencies like authentication, which are critical for effective use in a Bitbucket context.

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 schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond what the schema provides, such as examples or context for parameter usage. This meets the baseline score when the schema handles parameter documentation effectively.

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 verb ('Read') and resource ('a file from a Bitbucket repository'), making the purpose unambiguous. However, it does not distinguish this tool from potential alternatives like 'bb_write_file' or 'bb_delete_file' beyond the basic action, which prevents a perfect score.

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. For example, it does not mention that this is for reading existing files, not creating or modifying them, nor does it reference sibling tools like 'bb_write_file' or 'bb_delete_file' for related operations.

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