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
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| ref_type | Yes | Reference type | |
| ref_name | Yes | Reference name (branch/tag name) | |
| variables | No | Pipeline variables |
Implementation Reference
- src/tools/index.ts:1056-1068 (handler)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, }); }
- src/api/pipelines.ts:39-54 (helper)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 ); }
- src/tools/index.ts:265-280 (schema)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'), }),
- src/tools/index.ts:802-831 (registration)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'], }, },
- src/types/index.ts:354-367 (schema)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; }>; }