Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

list_commits

Retrieve commit history from a Bitbucket Cloud repository, with options to filter by branch, include/exclude specific commits, and paginate results.

Instructions

List commits in a repository with optional filtering by branch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
branchNoBranch name to filter commits
includeNoCommit to include
excludeNoCommit to exclude
pageNoPage number
pagelenNoResults per page

Implementation Reference

  • Core handler implementation in CommitsAPI.list: builds query parameters from input (handling branch as include) and calls Bitbucket API endpoint `/repositories/{workspace}/{repo_slug}/commits`.
    async list(params: ListCommitsParams): Promise<PaginatedResponse<BitbucketCommit>> { const { workspace, repo_slug, branch, include, exclude, ...queryParams } = params; // Build query params const allParams: Record<string, string | number | undefined> = { ...queryParams, }; // For branch filtering, use the include parameter if (branch) { allParams.include = branch; } else if (include) { allParams.include = include; } if (exclude) { allParams.exclude = exclude; } return this.client.get<PaginatedResponse<BitbucketCommit>>( `/repositories/${workspace}/${repo_slug}/commits`, allParams ); }
  • MCP tool handler in ToolHandler.handleTool: parses input arguments using Zod schema and delegates to CommitsAPI.list.
    case 'list_commits': { const params = toolSchemas.list_commits.parse(args); return this.commits.list(params); }
  • Zod input schema for list_commits tool used for argument validation and parsing.
    list_commits: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), branch: z.string().optional().describe('Branch name to filter commits'), include: z.string().optional().describe('Commit to include'), exclude: z.string().optional().describe('Commit to exclude'), page: z.number().optional().describe('Page number'), pagelen: z.number().optional().describe('Results per page'), }),
  • Tool registration in toolDefinitions array, including MCP-compatible input schema and description.
    { name: 'list_commits', description: 'List commits in a repository with optional filtering by branch.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, branch: { type: 'string', description: 'Branch name to filter commits' }, include: { type: 'string', description: 'Commit to include' }, exclude: { type: 'string', description: 'Commit to exclude' }, page: { type: 'number', description: 'Page number' }, pagelen: { type: 'number', description: 'Results per page' }, }, required: ['workspace', 'repo_slug'], }, },
  • TypeScript interface defining the input parameters for list commits.
    export interface ListCommitsParams { workspace: string; repo_slug: string; branch?: string; include?: string; exclude?: string; page?: number; pagelen?: number; }

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