Skip to main content
Glama
jlromano

Bitbucket MCP Server

by jlromano

get_file_content

Retrieve file contents from Bitbucket repositories to access code, documentation, or configuration files for review, analysis, or integration purposes.

Instructions

Get the content of a file from a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
pathYesThe file path
refNoThe reference (branch, tag, or commit hash) - defaults to HEAD

Implementation Reference

  • The implementation of the getFileContent method in the BitbucketClient class, which makes the API call to Bitbucket to retrieve file content.
    async getFileContent(workspace: string, repoSlug: string, path: string, ref?: string): Promise<string> {
      const params = ref ? { ref } : {};
      const response = await this.api.get(`/repositories/${workspace}/${repoSlug}/src/${ref || 'HEAD'}/${path}`, { params });
      return response.data;
    }
  • The MCP tool request handler case for get_file_content, which extracts arguments from the request and calls the BitbucketClient's getFileContent method.
    case 'get_file_content': {
      const { workspace, repo_slug, path, ref } = args as {
        workspace: string;
        repo_slug: string;
        path: string;
        ref?: string;
      };
      const content = await client.getFileContent(workspace, repo_slug, path, ref);
      return {
        content: [
          {
            type: 'text',
            text: content,
          },
        ],
      };
    }
  • The tool definition/schema for get_file_content, describing its inputs and purpose.
      name: 'get_file_content',
      description: 'Get the content of a file from a repository',
      inputSchema: {
        type: 'object',
        properties: {
          workspace: {
            type: 'string',
            description: 'The workspace slug',
          },
          repo_slug: {
            type: 'string',
            description: 'The repository slug',
          },
          path: {
            type: 'string',
            description: 'The file path',
          },
          ref: {
            type: 'string',
            description: 'The reference (branch, tag, or commit hash) - defaults to HEAD',
          },
        },
        required: ['workspace', 'repo_slug', 'path'],
      },
    },

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

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