Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

get_file_content

Retrieve file content from Bitbucket Cloud repositories to access code, documentation, or configuration files directly through the MCP server.

Instructions

Get the content of a file from a repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
pathYesFile path
refNoGit ref (branch, tag, or commit)

Implementation Reference

  • MCP tool handler for 'get_file_content' that validates input with Zod schema, delegates to RepositoriesAPI.getFileContent, and returns the file content.
    case 'get_file_content': {
      const params = toolSchemas.get_file_content.parse(args);
      const content = await this.repos.getFileContent(
        params.workspace,
        params.repo_slug,
        params.path,
        params.ref
      );
      return { content };
    }
  • Zod input schema definition for the 'get_file_content' tool.
    get_file_content: z.object({
      workspace: z.string().describe('The workspace slug'),
      repo_slug: z.string().describe('The repository slug'),
      path: z.string().describe('File path'),
      ref: z.string().optional().describe('Git ref (branch, tag, or commit)'),
    }),
  • Tool registration in toolDefinitions array, including name, description, and JSON schema for MCP.
    {
      name: 'get_file_content',
      description: 'Get the content of a file from a repository.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          workspace: { type: 'string', description: 'The workspace slug' },
          repo_slug: { type: 'string', description: 'The repository slug' },
          path: { type: 'string', description: 'File path' },
          ref: { type: 'string', description: 'Git ref (branch, tag, or commit)' },
        },
        required: ['workspace', 'repo_slug', 'path'],
      },
    },
  • Core implementation in RepositoriesAPI that constructs Bitbucket API endpoint and fetches raw file content using the client.
    async getFileContent(
      workspace: string,
      repo_slug: string,
      path: string,
      ref?: string
    ): Promise<string> {
      const endpoint = ref
        ? `/repositories/${workspace}/${repo_slug}/src/${ref}/${path}`
        : `/repositories/${workspace}/${repo_slug}/src/HEAD/${path}`;
      return this.client.getRaw(endpoint);
    }
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 mentions the action but lacks details on permissions, rate limits, error conditions, or output format (e.g., text, binary, size limits). This is a significant gap for a tool that likely interacts with a version control system.

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 function without unnecessary words. It's front-loaded with the core action, making it easy to parse quickly.

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 file retrieval (likely involving Git operations) and the absence of both annotations and an output schema, the description is insufficient. It doesn't cover behavioral aspects like authentication, error handling, or what the returned content looks like (e.g., raw text, encoding), leaving critical gaps for an agent.

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?

Schema description coverage is 100%, so the schema already documents all parameters (workspace, repo_slug, path, ref). The description adds no additional meaning beyond implying these parameters are needed to locate the file, which is already clear from the schema. This meets the baseline for high schema coverage.

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 ('Get the content') and resource ('a file from a repository'), making the purpose immediately understandable. However, it doesn't distinguish this tool from potential siblings like 'search_code' or 'get_commit_diff' that might also retrieve file content in different contexts, preventing 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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention if this is for raw file content retrieval versus metadata or if other tools like 'search_code' should be used for broader queries. The description only states what it does, not when it's appropriate.

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

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

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