Skip to content

Commit 1d57cad

Browse files
nick4evaclaude
andcommitted
feat(bitbucket): improve updatePullRequest tool descriptions to prevent missing version parameter
LLMs frequently call updatePullRequest without the required version parameter because the tool description didn't explain where to obtain it. Added explicit guidance to: - getPullRequest description: mentions it returns version needed for updates - updatePullRequest description: states version must be fetched first - version param description: directs callers to bitbucket_getPullRequest Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 46b88a5 commit 1d57cad

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/bitbucket/src/bitbucket-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ export const bitbucketToolSchemas = {
827827
projectKey: z.string().describe("The project key"),
828828
repositorySlug: z.string().describe("The repository slug"),
829829
pullRequestId: z.string().describe("The pull request ID"),
830-
version: z.number().describe("The current version of the pull request (required for optimistic locking)"),
830+
version: z.number().describe("The current version of the pull request (required for optimistic locking). Obtain this by calling bitbucket_getPullRequest first."),
831831
title: z.string().optional().describe("The new title for the pull request"),
832832
description: z.string().optional().describe("The new description for the pull request"),
833833
reviewers: z.array(z.string()).optional().describe("Optional array of reviewer usernames to set"),

packages/bitbucket/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ server.tool(
8585

8686
server.tool(
8787
"bitbucket_getPullRequest",
88-
"Get a specific pull request by ID. Returns full details including title, description, reviewers, participants, author, source/target branches, and current state.",
88+
"Get a specific pull request by ID. Returns full details including title, description, reviewers, participants, author, source/target branches, current state, and version (needed for bitbucket_updatePullRequest).",
8989
bitbucketToolSchemas.getPullRequest,
9090
async ({ projectKey, repositorySlug, pullRequestId }) => {
9191
const result = await bitbucketService.getPullRequest(projectKey, repositorySlug, pullRequestId);
@@ -174,7 +174,7 @@ server.tool(
174174

175175
server.tool(
176176
"bitbucket_updatePullRequest",
177-
"Update the title, description, reviewers, destination branch or draft status of an existing pull request. IMPORTANT: The reviewers parameter replaces ALL existing reviewers. If you want to preserve existing reviewers, first fetch the current PR details (using bitbucket_getPullRequests filtered by ID) and include those reviewers along with any new ones you want to add.",
177+
"Update the title, description, reviewers, destination branch or draft status of an existing pull request. IMPORTANT: You MUST first call bitbucket_getPullRequest to get the current 'version' number — this is required for optimistic locking and the call will fail without it. The reviewers parameter replaces ALL existing reviewers. If you want to preserve existing reviewers, include those from the current PR details along with any new ones you want to add.",
178178
bitbucketToolSchemas.updatePullRequest,
179179
async ({ projectKey, repositorySlug, pullRequestId, version, title, description, reviewers, output }) => {
180180
const result = await bitbucketService.updatePullRequest(projectKey, repositorySlug, pullRequestId, version, title, description, reviewers, output);

0 commit comments

Comments
 (0)