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 for review or processing.

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

  • Handler case in ToolHandler.handleTool that parses arguments and delegates to RepositoriesAPI.getFileContent
    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 schema for input validation used in the handler
    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 with MCP inputSchema
    { 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 fetches file content from Bitbucket API
    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); }

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