Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

add_pr_comment

Add comments to Bitbucket Cloud pull requests, including general feedback or inline comments on specific code lines to facilitate code review discussions.

Instructions

Add a comment to a pull request. Can be a general comment or an inline comment on a specific file/line.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
pr_idYesThe pull request ID
contentYesComment content (markdown)
pathNoFile path for inline comment
lineNoLine number for inline comment

Implementation Reference

  • Registration of the 'add_pr_comment' tool in the toolDefinitions array, including name, description, and input schema for MCP.
    { name: 'add_pr_comment', description: 'Add a comment to a pull request. Can be a general comment or an inline comment on a specific file/line.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, pr_id: { type: 'number', description: 'The pull request ID' }, content: { type: 'string', description: 'Comment content (markdown)' }, path: { type: 'string', description: 'File path for inline comment' }, line: { type: 'number', description: 'Line number for inline comment' }, }, required: ['workspace', 'repo_slug', 'pr_id', 'content'], }, },
  • Zod schema definition for validating inputs to the add_pr_comment tool.
    add_pr_comment: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), pr_id: z.number().describe('The pull request ID'), content: z.string().describe('Comment content (markdown)'), path: z.string().optional().describe('File path for inline comment'), line: z.number().optional().describe('Line number for inline comment'), }),
  • Tool handler logic in ToolHandler.handleTool that parses arguments using the schema and delegates to PullRequestsAPI.addComment.
    case 'add_pr_comment': { const params = toolSchemas.add_pr_comment.parse(args); const inline = params.path ? { path: params.path, line: params.line } : undefined; return this.prs.addComment( params.workspace, params.repo_slug, params.pr_id, params.content, inline ); }
  • Core implementation of adding a PR comment via Bitbucket API POST request to /pullrequests/{pr_id}/comments endpoint, constructing request body for general or inline comments.
    async addComment( workspace: string, repo_slug: string, pr_id: number, content: string, inline?: { path: string; line?: number } ): Promise<BitbucketPRComment> { const body: Record<string, unknown> = { content: { raw: content }, }; if (inline) { body.inline = { path: inline.path, to: inline.line, }; } return this.client.post<BitbucketPRComment>( `/repositories/${workspace}/${repo_slug}/pullrequests/${pr_id}/comments`, body ); }

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