Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

trigger_pipeline

Start a new pipeline run on a Bitbucket Cloud repository branch, tag, or bookmark to automate build, test, and deployment workflows.

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

  • Main handler case in ToolHandler.handleTool for the 'trigger_pipeline' tool. Parses arguments using Zod schema and calls PipelinesAPI.trigger to execute the pipeline trigger.
    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,
      });
    }
  • Zod schema definition for validating inputs to the trigger_pipeline tool.
    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'),
    }),
  • Tool registration in toolDefinitions array, including name, description, and MCP inputSchema.
    {
      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'],
      },
    },
  • PipelinesAPI.trigger method, which constructs the request body and makes the POST call to Bitbucket API to trigger the pipeline.
    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
      );
    }
  • TypeScript interface defining the 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;
      }>;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action without behavioral details. It doesn't disclose whether this is a mutating operation (implied by 'trigger'), what permissions are required, whether it's idempotent, rate limits, or what happens if a pipeline is already running. For a tool that likely modifies system state, this is a significant transparency 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, efficient sentence that front-loads the core action and scope. Every word contributes essential information with zero redundancy. It's appropriately sized for a tool with clear parameters documented elsewhere.

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 mutating tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after triggering (e.g., returns a pipeline ID, runs asynchronously), error conditions, or system impact. Given the complexity of pipeline execution and the lack of structured behavioral information, this leaves significant gaps for an agent.

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 parameters are well-documented in the schema itself. The description adds minimal value beyond the schema by mentioning 'branch, tag, or bookmark' which corresponds to the 'ref_type' enum, but doesn't explain parameter relationships or provide additional context about how these parameters interact during pipeline triggering.

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 ('trigger') and target ('new pipeline run') with specific scope ('on a branch, tag, or bookmark'), making the purpose immediately understandable. It distinguishes from siblings like 'stop_pipeline' or 'get_pipeline' by focusing on initiation rather than termination or retrieval. However, it doesn't explicitly differentiate from all pipeline-related tools in context.

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 on when to use this tool versus alternatives like 'stop_pipeline' or 'list_pipelines'. The description mentions triggering on specific reference types but doesn't explain prerequisites, dependencies, or typical use cases. Without annotations, this leaves the agent with insufficient context for optimal tool selection.

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

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