Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

list_commits

Retrieve commit history from a Bitbucket Cloud repository with branch filtering and pagination options to track code changes.

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

  • Handler logic in ToolHandler.handleTool method: parses arguments using the schema and delegates to CommitsAPI.list
    case 'list_commits': {
      const params = toolSchemas.list_commits.parse(args);
      return this.commits.list(params);
    }
  • Tool registration in toolDefinitions array, including name, description, and input schema definition
    {
      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'],
      },
    },
  • Zod schema definition for list_commits tool input validation
    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'),
    }),
  • Core implementation in CommitsAPI.list: constructs query parameters and makes API call to list 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
      );
    }
  • TypeScript interface defining the parameters for listing 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