GitLab MCP server tools for GitLab Duo Agent Platform
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
To provide feedback on this feature, leave a comment on issue 630189.
These tools are part of the duo_agent_platform toolset.
Use them to list GitLab Duo agents and flows, start sessions, check session status, and send input to a session.
For a list of all tools, see GitLab MCP server tools.
list_duo_agents_and_flows
Lists the GitLab Duo agents and flows enabled in a project, so you can discover what is available instead of guessing a flow name. Which agents and flows a project offers is configured per project, and their IDs differ between projects.
Each entry includes can_start_session, which is true for a flow you have permission to run,
and for a foundational chat agent when you can run sessions in CI in the project. A foundational
chat agent that doesn’t need the repository, such as Data Analyst, runs without a CI job, so it is
true when you can use GitLab Duo Agentic Chat in the project. The default
GitLab Duo agent, other agents, and external agents are listed for discovery only, and
can_start_session is always false for them. It is also false for a flow you cannot execute,
or whose version is unreleased or still a draft.
If you do not have a GitLab Ultimate subscription, a foundational chat agent that requires it is
either not listed or listed with can_start_session set to false.
Only flows with can_start_session set to true include the ai_catalog_item_consumer_id that
start_duo_session takes. To start a foundational chat agent, pass its workflow_definition as
agent. Descriptions might be truncated.
The list covers the agents, flows and external agents configured in the project, plus the
foundational chat agents. The chat agents are a fixed list rather than part of the paginated
project results, so they are returned with the first page only, and are omitted unless agents
are included. They come in addition to first, so the first page can contain more
entries than you asked for. They carry a workflow_definition instead of an
ai_catalog_item_consumer_id, which also tells apart the two agents that share the display
name GitLab Duo; entries configured in the project have workflow_definition set to null.
Foundational chat agents are governed by the project’s top-level group on GitLab.com, and by the organization on GitLab Self-Managed, rather than by the project.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | No | URL of the project. Provide exactly one of url or project_id. |
project_id | string | No | Numeric ID or full path of the project. Provide exactly one of url or project_id. |
item_type | string | No | Return only agent, flow or third_party_flow entries. All kinds are returned when omitted. |
include_triggers | boolean | No | Return the triggers of each entry, and keep disabled entries in the list. Default is false. |
after | string | No | Cursor for forward pagination. |
first | integer | No | Number of agents and flows to return for forward pagination. Default is 20, maximum is 100. |
Each call returns a single page of results.
If more pages exist, the response includes pageInfo.endCursor that you can pass as after.
Items that are configured but disabled are dropped after the page is fetched, so a page can
hold fewer entries than first, or none at all, while pageInfo.hasNextPage is still true.
Keep paging until hasNextPage is false instead of stopping at an empty page.
When include_triggers is true, disabled entries are kept, because a disabled flow does not
run when its triggers fire. Each entry then also includes:
enabled: whether the entry is enabled in the project.triggers: the triggers that start the entry, each with:id: numeric ID of the trigger.description: description of the trigger.event_types: the events that start the trigger, such asmention,assign, orscheduled.kind:eventorscheduled. Security policy triggers have no kind.active: whether the trigger is active.last_run: thestatus,started_at,finished_at, anderrorof the most recent run, ornullif the trigger has never run. For an entry inherited from the top-level group,last_rundoes not include sessions that its triggers started, sonulldoes not mean the trigger never ran.
triggers is null if you or your token do not have permission to view the entry’s triggers.
For an entry inherited from the top-level group, those are the group’s triggers.
Foundational chat agents have no triggers.
Examples:
Which Duo flows can I run in gitlab-org/gitlab?Why didn't the review flow run on my merge request in gitlab-org/gitlab?start_duo_session
Starts an asynchronous GitLab Duo Agent Platform session to accomplish a goal in a project.
Returns a workflow_id immediately. Use get_duo_session with that ID to track progress and retrieve the final result.
These tools are listed only when GitLab Duo Agent Platform is available for you. For more information, see select tool groups.
A flow runs in a CI job that can push commits and open merge requests, and so does a foundational agent that needs the repository. A foundational agent that doesn’t need it, such as Data Analyst, runs without a CI job and answers in seconds.
Provide exactly one of url or project_id. Provide at most one of flow, flow_item_id,
ai_catalog_item_consumer_id, or agent.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | No | Full GitLab URL of the project (for example, https://gitlab.com/group/project). Do not use with project_id. |
project_id | string | No | Numeric ID or full path of the project (for example, gitlab-org/gitlab). Do not use with url. |
goal | string | Yes | Natural-language goal for the session (for example, Fix the flaky spec in issue #1234 and open a merge request). Some flows take a URL instead, for example the failed pipeline’s URL for fix_pipeline/v1. |
flow | string | No | Foundational flow reference (for example, developer/v1, fix_pipeline/v1). Defaults to developer/v1 when no flow or agent is supplied. Do not use with flow_item_id, ai_catalog_item_consumer_id, or agent. |
flow_item_id | integer | No | AI Catalog item ID of a custom flow enabled in the project. The latest released version is run. Do not use with flow, ai_catalog_item_consumer_id, or agent. |
ai_catalog_item_consumer_id | integer | No | ID of the AI Catalog item consumer that configures which flow to run. Use list_duo_agents_and_flows to find it. Do not use with flow, flow_item_id, or agent. |
agent | string | No | Reference of a foundational agent to run (for example, analytics_agent/v1). The default GitLab Duo agent cannot be started. Do not use with flow, flow_item_id, or ai_catalog_item_consumer_id. |
The flow must be enabled for the project, or for an ancestor group of the project. If the flow is not enabled, the tool returns an error.
A flow behind a feature flag runs only when that flag is enabled. If a flow doesn’t meet these conditions, the tool returns an error.
Some flows expect the goal in a specific format, and the tool checks it before it starts the session:
fix_pipeline/v1expects the URL of the failed pipeline, in the same project. The session runs on the pipeline’s branch. If the pipeline belongs to an open merge request, the flow posts its suggested fix on that merge request. Otherwise, it opens a new merge request with the fix. If the goal is not a pipeline in the project, the tool returns an error and does not start a session.code_review/v1expects the URL or IID of a merge request. The session runs on the merge request’s source branch.
These are the same branch and merge request that the flow uses when you start it from the pipeline or merge request in the GitLab UI.
To start a foundational flow, use flow. If you pass a foundational flow’s AI Catalog item ID to
flow_item_id, the tool returns an error that names the flow value to use instead.
You can also pass a foundational agent’s reference to flow, or a foundational flow’s reference to
agent. The tool starts the session the same way as with the other parameter.
The response includes poll_after_seconds as a hint for how long to wait before calling get_duo_session.
Example:
Fix the flaky spec in issue #1234 and open an MR in gitlab-org/gitlablist_duo_sessions
Lists your GitLab Duo Agent Platform sessions, excluding Duo Chat sessions. Each session includes its individual status, goal preview, flow definition, and creation timestamp. Project and group sessions also include a session URL. The goal preview might be truncated.
Each session also includes source_merge_requests and source_work_items: the merge request or
work item the session was started from.
Each is an array with at most one entry, empty when the session has no source of that kind
or when you cannot read it.
Entries have id (the GraphQL global ID), iid, title, and url.
For older sessions, and for sessions that had a work item added after they started,
these sources can differ from the Source panel of the session page.
Use get_duo_session to get the sources shown in that panel.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | No | GitLab URL of the project to filter sessions by. Do not use with project_id. |
project_id | string | No | Numeric ID or full path of the project to filter sessions by. Do not use with url. |
status_group | string | No | Session status group. One of active, paused, awaiting_input, completed, failed, or canceled. |
statuses | array | No | Session statuses. One or more of created, running, paused, finished, failed, stopped, input_required, plan_approval_required, tool_call_approval_required, or idle. Do not use with status_group. |
after | string | No | Cursor for forward pagination. |
first | integer | No | Number of sessions to return for forward pagination. Default is 20, maximum is 100. |
The status_group filter can return sessions with multiple individual statuses.
Use statuses to filter by one or more exact statuses instead.
Each call returns a single page of results.
If more pages exist, the response includes pageInfo.endCursor that you can pass as after.
Example:
List my active Duo Agent Platform sessions in gitlab-org/gitlabget_duo_session
Checks the status of a GitLab Duo Agent Platform session. Running sessions include a suggested
polling delay, which is longer while the session waits for its CI job to start, and shorter for a
session that runs without a CI job. Finished sessions
and completed chat turns include the latest agent answer. The merge requests and work items the
session was started from are included as source_merge_requests and source_work_items. Each is an
array, empty when the session has no source of that kind. Entries have id (the GraphQL global ID),
iid, title, and url. If the source could not be read (for example, a timeout), both arrays are
empty and source_artifacts_unreadable is true, so a caller can tell that apart from a session
with no source.
Any merge request, work item or comment
the session created is included once it exists, as created_merge_requests, created_work_items
and created_notes. Each is an array, empty when the session created nothing of that kind, and
holds at most the 20 most recent items. When a list is cut off, artifacts_truncated names the
lists that were cut and artifact_limit gives the cap. Use get_merge_request with
include: ["notes"] to page through every comment on a merge request.
Sessions waiting for approval include instructions for continuing the session with
send_duo_session_input.
Failed sessions also include:
failure_reason: the reason recorded for the failure, ornullif no reason was recorded.job_url: the CI job that ran the session, ornullif no CI job ran or you cannot read its log.
When a session failed before its agent started, the response says it made no changes and can be started again. Sessions older than 30 days do not include this message. Checkpoints older than 30 days are not retained, so the tool cannot identify if the agent ran the session.
| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id | integer | Yes | ID of the Duo session, as returned by start_duo_session or list_duo_sessions. |
Example:
Check the status of Duo session 42send_duo_session_input
Answers a GitLab Duo Agent Platform session that is waiting for input: approves or rejects a
pending plan or tool call, or replies to a question the agent asked. Works for sessions started
from ai_catalog_item_consumer_id and for those started from agent. A session accepts input
when it is waiting with status input_required, plan_approval_required, or
tool_call_approval_required. A session that runs in CI accepts it once its last CI job has finished.
A session that ran in a CI job continues in a new one. A session that ran without a CI job
continues without one, and accepts one answer at a time: input sent while the agent is still
working is refused until the session pauses again. The response includes a suggested polling
delay; use get_duo_session with the same workflow_id to follow progress.
| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id | integer | Yes | ID of the Duo session, as returned by list_duo_sessions or get_duo_session. |
human_approval | boolean | Yes | true approves the pending plan or tool call. Do not include human_message with true, or the tool rejects the call instead of resuming the session. false rejects it: include human_message so the agent continues with your feedback. Without one, the agent is told not to proceed and the session continues. |
human_message | string | No | Your feedback for the agent, or your answer when the session asked a question, up to 2000 characters. Provide it with human_approval=false. With human_approval=true, the tool rejects the call instead of resuming the session. |
Examples:
Approve the plan for Duo session 42Reject the plan for Duo session 42 and ask it to also add tests