Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

list_pull_requests

Retrieve pull requests from a Bitbucket Cloud repository with filtering options to view open, merged, declined, or superseded requests.

Instructions

List pull requests for a repository with optional filtering by state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
stateNoFilter by state
pageNoPage number
pagelenNoResults per page

Implementation Reference

  • Core handler function in PullRequestsAPI that executes the Bitbucket API call to list pull requests for a repository.
    async list(params: ListPullRequestsParams): Promise<PaginatedResponse<BitbucketPullRequest>> {
      const { workspace, repo_slug, ...queryParams } = params;
      return this.client.get<PaginatedResponse<BitbucketPullRequest>>(
        `/repositories/${workspace}/${repo_slug}/pullrequests`,
        queryParams as Record<string, string | number | undefined>
      );
    }
  • Zod schema defining input parameters and validation for the list_pull_requests tool.
    list_pull_requests: z.object({
      workspace: z.string().describe('The workspace slug'),
      repo_slug: z.string().describe('The repository slug'),
      state: z
        .enum(['OPEN', 'MERGED', 'DECLINED', 'SUPERSEDED'])
        .optional()
        .describe('Filter by state'),
      page: z.number().optional().describe('Page number'),
      pagelen: z.number().optional().describe('Results per page'),
    }),
  • Tool registration in the toolDefinitions array, specifying name, description, and input schema for MCP.
    {
      name: 'list_pull_requests',
      description: 'List pull requests for a repository with optional filtering by state.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          workspace: { type: 'string', description: 'The workspace slug' },
          repo_slug: { type: 'string', description: 'The repository slug' },
          state: {
            type: 'string',
            enum: ['OPEN', 'MERGED', 'DECLINED', 'SUPERSEDED'],
            description: 'Filter by state',
          },
          page: { type: 'number', description: 'Page number' },
          pagelen: { type: 'number', description: 'Results per page' },
        },
        required: ['workspace', 'repo_slug'],
      },
    },
  • TypeScript interface defining the parameter types used by the handler.
    export interface ListPullRequestsParams {
      workspace: string;
      repo_slug: string;
      state?: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED';
      page?: number;
      pagelen?: number;
    }
  • Dispatch handler in ToolHandler.handleTool that parses arguments and calls the PullRequestsAPI.list method.
    case 'list_pull_requests': {
      const params = toolSchemas.list_pull_requests.parse(args);
      return this.prs.list(params);
    }

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