Skip to main content
Glama

update_pull_request

Modify an existing pull request by updating its title and description to reflect changes or improvements in the code review process.

Instructions

Update an existing pull request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoThe new description of the pull request.
pull_request_idYesThe ID of the pull request.
repository_nameYesName of the repository (repo slug)
titleNoThe new title of the pull request.

Implementation Reference

  • The main handler function that executes the tool logic: extracts arguments, validates inputs, makes PUT request to Bitbucket API to update PR, formats response or error.
    export async function updatePullRequest( axiosInstance: AxiosInstance, config: Config, args: any ): Promise<{ content: Array<{ type: string; text: string }> }> { try { const { repository_name, pull_request_id, title, description } = args; if (!repository_name || !pull_request_id) { throw new Error('Repository name and pull request ID are required'); } console.error( `Updating pull request ${pull_request_id} in repository: ${repository_name}` ); const response = await axiosInstance.put<PullRequest>( `/repositories/${config.BITBUCKET_WORKSPACE}/${repository_name}/pullrequests/${pull_request_id}`, { title, description, } ); const pr = response.data; const prDetails = `**Successfully updated PR #${pr.id}: ${pr.title}** - State: ${pr.state} - Author: ${pr.author.display_name} - Source: ${pr.source.branch.name} - Destination: ${pr.destination.branch.name} - URL: ${pr.links.html.href}`; return { content: [ { type: 'text', text: prDetails, }, ], }; } catch (error) { console.error('Error updating pull request:', error); return { content: [ { type: 'text', text: `Error updating pull request: ${ error instanceof Error ? error.message : 'Unknown error' }`, }, ], }; } }
  • Tool metadata and input schema definition used for tool discovery and argument validation.
    export const updatePullRequestTool = { name: 'update_pull_request', description: 'Update an existing pull request.', inputSchema: { type: 'object', properties: { repository_name: { type: 'string', description: 'Name of the repository (repo slug)', }, pull_request_id: { type: 'string', description: 'The ID of the pull request.', }, title: { type: 'string', description: 'The new title of the pull request.', }, description: { type: 'string', description: 'The new description of the pull request.', }, }, required: ['repository_name', 'pull_request_id'], }, };
  • src/index.ts:66-68 (registration)
    Import statement for the handler function and tool definition.
    updatePullRequest, updatePullRequestTool, } from './tools/pull-requests/updatePullRequest.js';
  • src/index.ts:131-131 (registration)
    Registers the tool in the listTools response handler.
    updatePullRequestTool,
  • src/index.ts:170-170 (registration)
    Maps the tool name to its handler function in the callTool request handler.
    update_pull_request: updatePullRequest,

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

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