Skip to main content
Glama
Korfu
by Korfu

update_repository_branching_model_settings

Configure repository branching rules to define development, production, and branch type settings for structured workflow management.

Instructions

Update the branching model configuration for a repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repository_nameYesName of the repository (repo slug)
settingsYesThe branching model settings to update. Only passed properties will be updated. See Bitbucket API for details.

Implementation Reference

  • The async handler function that executes the tool logic, making a PUT request to the Bitbucket API to update branching model settings.
    export async function updateRepositoryBranchingModelSettings(
      axiosInstance: AxiosInstance,
      config: Config,
      args: any
    ): Promise<{ content: Array<{ type: string; text: string }> }> {
      try {
        const repositoryName = args?.repository_name;
        const settings = args?.settings as BranchingModelSettings;
    
        if (!repositoryName) {
          throw new Error('Repository name is required');
        }
        if (!settings) {
          throw new Error('Settings object is required');
        }
    
        console.error(
          `Updating branching model for repository: ${repositoryName}`
        );
    
        const response = await axiosInstance.put(
          `/repositories/${config.BITBUCKET_WORKSPACE}/${repositoryName}/branching-model/settings`,
          settings
        );
    
        return {
          content: [
            {
              type: 'text',
              text: `Successfully updated branching model settings for repository "${repositoryName}".\n\n${JSON.stringify(
                response.data,
                null,
                2
              )}`,
            },
          ],
        };
      } catch (error) {
        console.error('Error updating repository branching model settings:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error updating repository branching model settings: ${
                error instanceof Error ? error.message : 'Unknown error'
              }`,
            },
          ],
        };
      }
    } 
  • The tool object defining the name, description, and inputSchema for validation.
    export const updateRepositoryBranchingModelSettingsTool = {
      name: 'update_repository_branching_model_settings',
      description: 'Update the branching model configuration for a repository.',
      inputSchema: {
        type: 'object',
        properties: {
          repository_name: {
            type: 'string',
            description: 'Name of the repository (repo slug)',
          },
          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: ['repository_name', 'settings'],
      },
    };
  • src/index.ts:120-120 (registration)
    Registration of the tool in the listTools response array.
    updateRepositoryBranchingModelSettingsTool,
  • src/index.ts:157-158 (registration)
    Registration of the handler function in the CallToolRequest handler map.
    update_repository_branching_model_settings:
      updateRepositoryBranchingModelSettings,
  • src/index.ts:28-31 (registration)
    Import of the tool and handler from the implementation file.
    import {
      updateRepositoryBranchingModelSettings,
      updateRepositoryBranchingModelSettingsTool,
    } from './tools/branch-restrictions/updateRepositoryBranchingModelSettings.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