Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

trigger_pipeline

Start a new pipeline run on a Bitbucket Cloud repository by specifying a branch, tag, or bookmark reference to automate build and deployment processes.

Instructions

Trigger a new pipeline run on a branch, tag, or bookmark.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
ref_typeYesReference type
ref_nameYesReference name (branch/tag name)
variablesNoPipeline variables

Implementation Reference

  • MCP tool handler for 'trigger_pipeline' in ToolHandler.handleTool. Parses arguments using Zod schema and calls PipelinesAPI.trigger with formatted parameters.
    case 'trigger_pipeline': { const params = toolSchemas.trigger_pipeline.parse(args); return this.pipelines.trigger({ workspace: params.workspace, repo_slug: params.repo_slug, target: { type: 'pipeline_ref_target', ref_type: params.ref_type, ref_name: params.ref_name, }, variables: params.variables, }); }
  • Core implementation of pipeline triggering in PipelinesAPI. Constructs POST body with target ref and variables, sends to Bitbucket API endpoint.
    async trigger(params: TriggerPipelineParams): Promise<BitbucketPipeline> { const { workspace, repo_slug, target, variables } = params; const body: Record<string, unknown> = { target, }; if (variables && variables.length > 0) { body.variables = variables; } return this.client.post<BitbucketPipeline>( `/repositories/${workspace}/${repo_slug}/pipelines`, body ); }
  • Zod schema definition for trigger_pipeline input validation in toolSchemas.
    trigger_pipeline: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), ref_type: z.enum(['branch', 'tag', 'bookmark']).describe('Reference type'), ref_name: z.string().describe('Reference name (branch/tag name)'), variables: z .array( z.object({ key: z.string(), value: z.string(), secured: z.boolean().optional(), }) ) .optional() .describe('Pipeline variables'), }),
  • MCP tool registration in toolDefinitions array, including name, description, and JSON schema for input.
    name: 'trigger_pipeline', description: 'Trigger a new pipeline run on a branch, tag, or bookmark.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, ref_type: { type: 'string', enum: ['branch', 'tag', 'bookmark'], description: 'Reference type', }, ref_name: { type: 'string', description: 'Reference name (branch/tag name)' }, variables: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, value: { type: 'string' }, secured: { type: 'boolean' }, }, required: ['key', 'value'], }, description: 'Pipeline variables', }, }, required: ['workspace', 'repo_slug', 'ref_type', 'ref_name'], }, },
  • TypeScript interface for TriggerPipelineParams used by PipelinesAPI.trigger.
    export interface TriggerPipelineParams { workspace: string; repo_slug: string; target: { type: 'pipeline_ref_target'; ref_type: 'branch' | 'tag' | 'bookmark'; ref_name: string; }; variables?: Array<{ key: string; value: string; secured?: boolean; }>; }

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