Skip to main content
Glama
Bitbucket MCP Server
by pdogra1299

get_pull_request_diff

Read-only

Fetches a pull request's raw unified diff for code review, letting you scope output to specific files or include/exclude glob patterns.

Instructions

Get a PR diff as raw unified diff text (line numbers derive from @@ headers; +/- prefixes mark ADDED/REMOVED). Scope with file_path (server-side) or include/exclude glob patterns.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "workspace": "<workspace>",
      "repository": "<repository>",
      "pull_request_id": "<pull_request_id>"
    },
    "name": "get_pull_request_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
file_pathNoDiff one file only
workspaceYesProject key (e.g., PROJ)
repositoryYesRepository slug
context_linesNoDefault 3; 0 = minimal
pull_request_idYesPull request ID
exclude_patternsNoGlobs to exclude
include_patternsNoGlobs to include
ignore_whitespaceNoServer only

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv3.0.1
    • changedInput schema / properties / context_lines / description
      Previous value: -"Number of context lines around changes (optional, default: 3)"New value: +"Default 3; 0 = minimal"
    • changedInput schema / properties / exclude_patterns / description
      Previous value: -"Array of glob patterns to exclude (e.g., [\"*.lock\", \"*.svg\"]) (optional)"New value: +"Globs to exclude"
    • changedInput schema / properties / file_path / description
      Previous value: -"Specific file path to get diff for (e.g., \"src/index.ts\") (optional)"New value: +"Diff one file only"
    • addedInput schema / properties / ignore_whitespace
      Added value: +{
      +  "description": "Server only",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / include_patterns / description
      Previous value: -"Array of glob patterns to include (e.g., [\"*.res\", \"src/**/*.js\"]) (optional)"New value: +"Globs to include"
    • changedInput schema / properties / repository / description
      Previous value: -"Repository slug (e.g., \"my-repo\")"New value: +"Repository slug"
    • changedInput schema / properties / workspace / description
      Previous value: -"Bitbucket workspace/project key (e.g., \"PROJ\")"New value: +"Project key (e.g., PROJ)"
  2. First observedv1.0.0

TDQS

A3.9/5.0
Behavior4/5

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

readOnlyHint=true already declares the safety profile, so the description's job is to add context beyond that, and it does: it discloses the return format and how to interpret '@@' headers and +/- prefixes. It omits limits such as truncation on very large diffs or the cost of fetching an unscoped diff, which would matter operationally.

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?

Two dense sentences with no filler; the output-format fact leads and the scoping options follow. Every clause carries information an agent needs.

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

Completeness4/5

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

For an 8-parameter, read-only fetch tool with no output schema, the description covers purpose, format interpretation, and scope control. It leaves unaddressed what happens on very large PRs (truncation, pagination) and how include/exclude and file_path interact when combined.

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

Parameters4/5

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

With 100% schema coverage the baseline is 3, and the description earns an extra point by distinguishing file_path as 'server-side' scoping versus glob patterns, implying the globs are applied after retrieval. That is a meaningful semantic distinction the schema's one-line property descriptions do not convey.

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

Purpose4/5

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

States a specific verb and resource ('Get a PR diff') and pins down the exact output form ('raw unified diff text'), which is more precise than a generic 'get' would be. It never names a sibling such as get_pull_request (metadata) or get_file_content, so the boundary is inferable but not explicit.

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

Usage Guidelines3/5

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

The second sentence explains how to narrow scope via file_path or include/exclude globs, which is genuinely actionable. It never says when this tool is preferred over get_pull_request or when a diff would be too large to fetch this way, so usage is implied rather than stated.

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