Skip to main content

Overview

Save the credentials in a GitHub or GitLab connection before using these tools. The optional connection parameter accepts a saved connection such as github.personal or gitlab.work; omit it to use the platform’s default connection. Repository access is checked for the current user or agent.

Tool Name

Purpose

The ci_pipeline_tools group gives agents one vocabulary for GitHub Actions and GitLab CI: start a run, find and follow it, inspect the job that failed, cancel a run, or retry it. GitHub runs are workflow runs; GitLab runs are pipelines.

Functions Available

ci_run_pipeline

Starts a GitHub Actions workflow or a GitLab pipeline on a branch or tag.
GitHub may accept the dispatch before it creates a run. In that case the result has dispatched=true and run_id=None; use ci_list_pipeline_runs with the workflow to find the newly created run instead of guessing an id.

ci_get_pipeline_run

Checks one run and returns its status, ref, commit SHA, URL, and jobs. Pass the GitHub Actions run ID or GitLab pipeline ID as run_id. Poll this tool while a run is queued or running. Jobs can be empty until execution starts. When a job fails, use ci_get_pipeline_logs to read its output.

ci_list_pipeline_runs

Lists recent runs newest first. Use it to find a GitHub run after dispatch, inspect a branch’s recent CI history, or find a run ID to follow.

ci_get_pipeline_logs

Reads the failed job’s log, falling back to the last job when no job has failed. The end of the log is returned because failures usually appear there. The result includes truncated=true when the log exceeded the requested size. If the run has no jobs yet, poll ci_get_pipeline_run and request the log again. On GitHub the result also lists failed_steps, the steps of the job that did not succeed. GitHub serves Actions logs from Azure Blob Storage, not from api.github.com, so a deployment whose network egress does not reach that host cannot read the log. This is the default on Snowflake. In that case the result has success=false but still carries failed_steps and annotations: the ::error and ::warning lines the job emitted, with file and line, read from the GitHub API. If the annotations cannot be read, annotations_error says why. A GitHub App installation or fine-grained token needs Checks: read for them. See GitHub Repository Integration to allow the log host.

ci_cancel_pipeline_run

Requests cancellation of a run that is still executing. Cancellation is asynchronous. Read the run again with ci_get_pipeline_run to see the final state; do not submit the cancellation repeatedly.

ci_retry_pipeline_run

Retries a completed run without requiring a new commit. GitHub reruns the workflow; GitLab retries the failed jobs in the pipeline. Follow the restarted run with ci_get_pipeline_run. Retrying consumes CI build minutes and can repeat a deployment.

Typical Workflow

  1. Save and authorize the GitHub or GitLab connection.
  2. Call ci_run_pipeline with the repository, ref, and (for GitHub) workflow.
  3. If GitHub returns no run_id, call ci_list_pipeline_runs for that workflow.
  4. Poll ci_get_pipeline_run until the run finishes.
  5. If it fails, call ci_get_pipeline_logs to inspect the failed job.
  6. Use ci_cancel_pipeline_run or ci_retry_pipeline_run only when the user confirms the action.
These tools start real CI and can deploy. Confirm the target branch or tag before starting, cancelling, or retrying a run.