pipelines_run_pipeline
Trigger Azure DevOps pipeline runs with custom parameters, variables, and resource configurations to automate build and deployment workflows.
Instructions
Triggers a new pipeline run with optional parameters and variables
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organization | Yes | The name of the Azure DevOps organization | |
| project | Yes | Project ID or name to run the build in | |
| pipelineId | Yes | ID of the pipeline to run | |
| pipelineVersion | No | Version of the pipeline to run. If not provided, the latest version will be used. | |
| previewRun | No | If true, returns the final YAML document after parsing templates without creating a new run. | |
| resources | No | A dictionary of resources to pass to the pipeline. | |
| stagesToSkip | No | A list of stages to skip. | |
| templateParameters | No | Custom build parameters as key-value pairs | |
| variables | No | A dictionary of variables to pass to the pipeline. | |
| yamlOverride | No | YAML override for the pipeline run. |
Implementation Reference
- src/tools/pipelines.ts:344-364 (handler)The handler function that executes the tool: validates yamlOverride with previewRun, constructs the runRequest, calls pipelinesApi.runPipeline, and returns the pipeline run as JSON text.async ({ organization, project, pipelineId, pipelineVersion, previewRun, resources, stagesToSkip, templateParameters, variables, yamlOverride }) => { if (!previewRun && yamlOverride) { throw new Error("Parameter 'yamlOverride' can only be specified together with parameter 'previewRun'."); } const connection = await connectionManager.getConnection(organization); const pipelinesApi = await connection.getPipelinesApi(); const runRequest = { previewRun: previewRun, resources: { ...resources, }, stagesToSkip: stagesToSkip, templateParameters: templateParameters, variables: variables, yamlOverride: yamlOverride, }; const pipelineRun = await pipelinesApi.runPipeline(runRequest as any, project, pipelineId, pipelineVersion); return { content: [{ type: "text", text: JSON.stringify(pipelineRun, null, 2) }], }; }
- src/tools/pipelines.ts:332-343 (schema)Zod schema defining the input parameters for the pipelines_run_pipeline tool, including organization, project, pipelineId, and optional parameters like variables, resources, etc.{ organization: z.string().describe("The name of the Azure DevOps organization"), project: z.string().describe("Project ID or name to run the build in"), pipelineId: z.number().describe("ID of the pipeline to run"), pipelineVersion: z.number().optional().describe("Version of the pipeline to run. If not provided, the latest version will be used."), previewRun: z.boolean().optional().describe("If true, returns the final YAML document after parsing templates without creating a new run."), resources: resourcesSchema.optional().describe("A dictionary of resources to pass to the pipeline."), stagesToSkip: z.array(z.string()).optional().describe("A list of stages to skip."), templateParameters: z.record(z.string(), z.string()).optional().describe("Custom build parameters as key-value pairs"), variables: z.record(z.string(), variableSchema).optional().describe("A dictionary of variables to pass to the pipeline."), yamlOverride: z.string().optional().describe("YAML override for the pipeline run."), },
- src/tools/pipelines.ts:329-365 (registration)The server.tool call that registers the pipelines_run_pipeline tool with its schema and handler function.server.tool( "pipelines_run_pipeline", "Triggers a new pipeline run with optional parameters and variables", { organization: z.string().describe("The name of the Azure DevOps organization"), project: z.string().describe("Project ID or name to run the build in"), pipelineId: z.number().describe("ID of the pipeline to run"), pipelineVersion: z.number().optional().describe("Version of the pipeline to run. If not provided, the latest version will be used."), previewRun: z.boolean().optional().describe("If true, returns the final YAML document after parsing templates without creating a new run."), resources: resourcesSchema.optional().describe("A dictionary of resources to pass to the pipeline."), stagesToSkip: z.array(z.string()).optional().describe("A list of stages to skip."), templateParameters: z.record(z.string(), z.string()).optional().describe("Custom build parameters as key-value pairs"), variables: z.record(z.string(), variableSchema).optional().describe("A dictionary of variables to pass to the pipeline."), yamlOverride: z.string().optional().describe("YAML override for the pipeline run."), }, async ({ organization, project, pipelineId, pipelineVersion, previewRun, resources, stagesToSkip, templateParameters, variables, yamlOverride }) => { if (!previewRun && yamlOverride) { throw new Error("Parameter 'yamlOverride' can only be specified together with parameter 'previewRun'."); } const connection = await connectionManager.getConnection(organization); const pipelinesApi = await connection.getPipelinesApi(); const runRequest = { previewRun: previewRun, resources: { ...resources, }, stagesToSkip: stagesToSkip, templateParameters: templateParameters, variables: variables, yamlOverride: yamlOverride, }; const pipelineRun = await pipelinesApi.runPipeline(runRequest as any, project, pipelineId, pipelineVersion); return { content: [{ type: "text", text: JSON.stringify(pipelineRun, null, 2) }], }; } );