Skip to main content
Glama
garc33

Bitbucket Server MCP

by garc33

get_pull_request

Retrieve comprehensive pull request details including status, reviewers, commits, and metadata from Bitbucket Server to check progress, understand changes, and prepare for actions like merging or commenting.

Instructions

Retrieve comprehensive details about a specific pull request including status, reviewers, commits, and metadata. Use this to check PR status, review progress, understand changes, or gather information before performing actions like merging or commenting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoBitbucket project key. If omitted, uses BITBUCKET_DEFAULT_PROJECT environment variable.
repositoryYesRepository slug containing the pull request.
prIdYesUnique pull request ID number (e.g., 123, 456).

Implementation Reference

  • The core handler function that executes the get_pull_request tool by calling the Bitbucket API to fetch PR details and returns formatted JSON response.
    private async getPullRequest(params: PullRequestParams) {
      const { project, repository, prId } = params;
      
      if (!project || !repository || !prId) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Project, repository, and prId are required'
        );
      }
      
      const response = await this.api.get(
        `/projects/${project}/repos/${repository}/pull-requests/${prId}`
      );
    
      return {
        content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }]
      };
    }
  • Input schema definition for the get_pull_request tool, registered in ListToolsRequestSchema handler.
    {
      name: 'get_pull_request',
      description: 'Retrieve comprehensive details about a specific pull request including status, reviewers, commits, and metadata. Use this to check PR status, review progress, understand changes, or gather information before performing actions like merging or commenting.',
      inputSchema: {
        type: 'object',
        properties: {
          project: { type: 'string', description: 'Bitbucket project key. If omitted, uses BITBUCKET_DEFAULT_PROJECT environment variable.' },
          repository: { type: 'string', description: 'Repository slug containing the pull request.' },
          prId: { type: 'number', description: 'Unique pull request ID number (e.g., 123, 456).' }
        },
        required: ['repository', 'prId']
      }
    },
  • src/index.ts:450-457 (registration)
    Tool dispatch/registration in the switch statement of CallToolRequestSchema handler, which prepares parameters and calls the handler.
    case 'get_pull_request': {
      const getPrParams: PullRequestParams = {
        project: getProject(args.project as string),
        repository: args.repository as string,
        prId: args.prId as number
      };
      return await this.getPullRequest(getPrParams);
    }
  • TypeScript interface defining parameters for pull request operations, used by getPullRequest handler.
    interface PullRequestParams extends RepositoryParams {
      prId?: number;
    }
  • src/index.ts:162-162 (registration)
    List of read-only tools that includes get_pull_request, used to filter tools in read-only mode.
    const readOnlyTools = ['list_projects', 'list_repositories', 'get_pull_request', 'get_diff', 'get_reviews', 'get_activities', 'get_comments', 'search', 'get_file_content', 'browse_repository'];
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It implies a read-only operation through verbs like 'retrieve' and 'check,' but doesn't explicitly state permission requirements, rate limits, or error behaviors. It adds some context about the scope of returned data but lacks details on pagination or response format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured in two sentences: the first states the purpose and scope, the second provides usage guidelines. Every phrase adds value without redundancy, making it appropriately sized and front-loaded with essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read operation with 3 parameters, 100% schema coverage, and no output schema, the description provides adequate purpose and usage context. However, without annotations or output schema, it lacks details on return format, error handling, or authentication needs, leaving some gaps for the agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 for adequate but not enhanced parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieve' and resource 'pull request' with specific details included ('comprehensive details about a specific pull request including status, reviewers, commits, and metadata'). It distinguishes from siblings like get_comments or get_diff by emphasizing comprehensive details rather than specific aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('to check PR status, review progress, understand changes, or gather information before performing actions like merging or commenting'), which helps differentiate it from write-oriented siblings like merge_pull_request. However, it doesn't explicitly state when NOT to use it or name specific alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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