Skip to main content
Glama
pdogra1299
by pdogra1299

request_changes

Submit feedback and request revisions on Bitbucket pull requests by specifying workspace, repository, and pull request ID, with an optional comment to clarify changes needed.

Instructions

Request changes on a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commentNoComment explaining requested changes (optional)
pull_request_idYesPull request ID
repositoryYesRepository slug (e.g., "my-repo")
workspaceYesBitbucket workspace/project key (e.g., "PROJ")

Implementation Reference

  • The main handler function that implements the request_changes tool. It validates arguments using isRequestChangesArgs, makes API calls to Bitbucket Cloud or Server to set 'needs work' or 'request-changes' status on the pull request, optionally adds a comment, and returns a success message.
    async handleRequestChanges(args: any) {
      if (!isRequestChangesArgs(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for request_changes'
        );
      }
    
      const { workspace, repository, pull_request_id, comment } = args;
    
      try {
        if (this.apiClient.getIsServer()) {
          // Bitbucket Server API - use needs-work status
          const username = this.username.replace('@', '_');
          const apiPath = `/rest/api/latest/projects/${workspace}/repos/${repository}/pull-requests/${pull_request_id}/participants/${username}`;
          await this.apiClient.makeRequest<any>('put', apiPath, { status: 'NEEDS_WORK' });
          
          // Add comment if provided
          if (comment) {
            const commentPath = `/rest/api/1.0/projects/${workspace}/repos/${repository}/pull-requests/${pull_request_id}/comments`;
            await this.apiClient.makeRequest<any>('post', commentPath, { text: comment });
          }
        } else {
          // Bitbucket Cloud API - use request-changes status
          const apiPath = `/repositories/${workspace}/${repository}/pullrequests/${pull_request_id}/request-changes`;
          await this.apiClient.makeRequest<any>('post', apiPath);
          
          // Add comment if provided
          if (comment) {
            const commentPath = `/repositories/${workspace}/${repository}/pullrequests/${pull_request_id}/comments`;
            await this.apiClient.makeRequest<any>('post', commentPath, {
              content: { raw: comment }
            });
          }
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                message: 'Changes requested on pull request',
                pull_request_id,
                requested_by: this.username,
                comment: comment || 'No comment provided'
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return this.apiClient.handleApiError(error, `requesting changes on pull request ${pull_request_id} in ${workspace}/${repository}`);
      }
    }
  • The tool definition including name, description, and input schema for validation in the MCP server.
    {
      name: 'request_changes',
      description: 'Request changes on a pull request',
      inputSchema: {
        type: 'object',
        properties: {
          workspace: {
            type: 'string',
            description: 'Bitbucket workspace/project key (e.g., "PROJ")',
          },
          repository: {
            type: 'string',
            description: 'Repository slug (e.g., "my-repo")',
          },
          pull_request_id: {
            type: 'number',
            description: 'Pull request ID',
          },
          comment: {
            type: 'string',
            description: 'Comment explaining requested changes (optional)',
          },
        },
        required: ['workspace', 'repository', 'pull_request_id'],
      },
    },
  • src/index.ts:128-129 (registration)
    Registration of the request_changes tool in the main server switch statement, routing calls to the ReviewHandlers.handleRequestChanges method.
    case 'request_changes':
      return this.reviewHandlers.handleRequestChanges(request.params.arguments);
  • Type guard function used in the handler to validate input arguments match the expected schema for request_changes.
    export const isRequestChangesArgs = (
      args: any
    ): args is {
      workspace: string;
      repository: string;
      pull_request_id: number;
      comment?: string;
    } =>
      typeof args === 'object' &&
      args !== null &&
      typeof args.workspace === 'string' &&
      typeof args.repository === 'string' &&
      typeof args.pull_request_id === 'number' &&
      (args.comment === undefined || typeof args.comment === 'string');
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It states the action but doesn't explain what 'request changes' actually does (e.g., does it block merging? Is it reversible? What permissions are required?). For a mutation tool affecting pull request state, this lack of behavioral context is a significant gap.

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?

The description is a single, focused sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a tool with good schema documentation and gets straight to the point with zero wasted content.

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

Completeness2/5

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

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after requesting changes, what the tool returns, error conditions, or behavioral implications. Given the complexity of pull request workflows and the presence of many sibling tools, more context is needed for effective use.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 4 parameters. The description adds no additional parameter information beyond what's in the schema. This meets the baseline expectation when schema coverage is complete, but doesn't provide extra value like explaining parameter interactions or constraints.

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?

The description clearly states the action ('Request changes') and target resource ('on a pull request'), making the purpose immediately understandable. It distinguishes from siblings like 'approve_pull_request' or 'merge_pull_request' by indicating a different review action. However, it doesn't specify what 'request changes' entails operationally beyond the basic verb.

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

Usage Guidelines2/5

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

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., needing review permissions), timing considerations, or how this differs from similar tools like 'add_comment' or 'update_pull_request'. Without this context, an agent must infer usage from the tool name alone.

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

Install Server

Other Tools

Related Tools

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

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