Skip to main content
Glama
garc33

Bitbucket Server MCP

by garc33

get_comments

Retrieve pull request comments to read discussion and feedback without other activities like reviews or commits.

Instructions

Retrieve only the comments from a pull request. Use this when you specifically want to read the discussion and feedback comments without other activities like reviews or commits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoBitbucket project key. If omitted, uses BITBUCKET_DEFAULT_PROJECT environment variable.
repositoryYesRepository slug containing the pull request.
prIdYesPull request ID to get comments for.

Implementation Reference

  • The main handler function that implements the get_comments tool logic: fetches PR activities from Bitbucket API and filters for comments (action === 'COMMENTED').
    private async getComments(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}/activities` ); const comments = response.data.values.filter( (activity: BitbucketActivity) => activity.action === 'COMMENTED' ); return { content: [{ type: 'text', text: JSON.stringify(comments, null, 2) }] }; }
  • Input schema definition for the get_comments tool, specifying parameters: project (optional), repository, prId.
    { name: 'get_comments', description: 'Retrieve only the comments from a pull request. Use this when you specifically want to read the discussion and feedback comments without other activities like reviews or commits.', 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: 'Pull request ID to get comments for.' } }, required: ['repository', 'prId'] } },
  • src/index.ts:538-545 (registration)
    Registration in the central tool request handler switch statement that dispatches get_comments calls to the getComments method.
    case 'get_comments': { const commentsPrParams: PullRequestParams = { project: getProject(args.project as string), repository: args.repository as string, prId: args.prId as number }; return await this.getComments(commentsPrParams); }
  • src/index.ts:394-394 (registration)
    The tool list (including get_comments) is registered to the MCP server via setTools, filtered for read-only mode.
    ].filter(tool => !this.config.readOnly || readOnlyTools.includes(tool.name))
  • src/index.ts:162-162 (registration)
    get_comments is included in readOnlyTools array, allowing it 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'];

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