Skip to main content
Glama
Korfu
by Korfu

update_project_branching_model_settings

Modify branching model settings for a Bitbucket project to define development, production, and branch type configurations.

Instructions

Update the branching model configuration for a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_keyYesThe key of the project.
settingsYesThe branching model settings to update. Only passed properties will be updated. See Bitbucket API for details.

Implementation Reference

  • The handler function that updates the project's branching model settings via Bitbucket API PUT request to /workspaces/{workspace}/projects/{projectKey}/branching-model/settings.
    export async function updateProjectBranchingModelSettings(
      axiosInstance: AxiosInstance,
      config: Config,
      args: any
    ): Promise<{ content: Array<{ type: string; text: string }> }> {
      try {
        const projectKey = args?.project_key;
        const settings = args?.settings as BranchingModelSettings;
    
        if (!projectKey) {
          throw new Error('Project key is required');
        }
        if (!settings) {
          throw new Error('Settings object is required');
        }
    
        console.error(`Updating branching model for project: ${projectKey}`);
    
        const response = await axiosInstance.put(
          `/workspaces/${config.BITBUCKET_WORKSPACE}/projects/${projectKey}/branching-model/settings`,
          settings
        );
    
        return {
          content: [
            {
              type: 'text',
              text: `Successfully updated branching model settings for project "${projectKey}".\n\n${JSON.stringify(
                response.data,
                null,
                2
              )}`,
            },
          ],
        };
      } catch (error) {
        console.error('Error updating project branching model settings:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error updating project branching model settings: ${
                error instanceof Error ? error.message : 'Unknown error'
              }`,
            },
          ],
        };
      }
    } 
  • Tool definition including name, description, and detailed inputSchema for parameters project_key and settings (development, production, branch_types).
    export const updateProjectBranchingModelSettingsTool = {
      name: 'update_project_branching_model_settings',
      description: 'Update the branching model configuration for a project.',
      inputSchema: {
        type: 'object',
        properties: {
          project_key: {
            type: 'string',
            description: 'The key of the project.',
          },
          settings: {
            type: 'object',
            description:
              'The branching model settings to update. Only passed properties will be updated. See Bitbucket API for details.',
            properties: {
              development: {
                type: 'object',
                properties: {
                  use_mainbranch: { type: 'boolean' },
                  name: { type: 'string' },
                },
              },
              production: {
                type: 'object',
                properties: {
                  enabled: { type: 'boolean' },
                  use_mainbranch: { type: 'boolean' },
                  name: { type: 'string' },
                },
              },
              branch_types: {
                type: 'array',
                items: {
                  type: 'object',
                  properties: {
                    kind: {
                      type: 'string',
                      enum: ['release', 'hotfix', 'feature', 'bugfix'],
                    },
                    enabled: { type: 'boolean' },
                    prefix: { type: 'string' },
                  },
                  required: ['kind'],
                },
              },
            },
          },
        },
        required: ['project_key', 'settings'],
      },
    };
  • src/index.ts:159-160 (registration)
    Maps the tool name to its handler function in the CallToolRequest handler dictionary.
    update_project_branching_model_settings:
      updateProjectBranchingModelSettings,
  • src/index.ts:121-121 (registration)
    Registers the tool in the list returned by ListToolsRequest.
    updateProjectBranchingModelSettingsTool,
  • src/index.ts:33-35 (registration)
    Imports the tool and handler function.
      updateProjectBranchingModelSettings,
      updateProjectBranchingModelSettingsTool,
    } from './tools/branch-restrictions/updateProjectBranchingModelSettings.js';

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