> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab

> GitlabTools provides read-focused access to GitLab projects, merge requests, and issues.

**GitlabTools** enables an Agent to read GitLab project, merge request, and issue data.

## Prerequisites

Install the required dependencies:

```shell theme={null}
uv pip install -U python-gitlab httpx openai
```

Set environment variables:

```shell theme={null}
export GITLAB_ACCESS_TOKEN="YOUR_GITLAB_ACCESS_TOKEN"
export GITLAB_BASE_URL="https://gitlab.com"
```

`GITLAB_BASE_URL` is optional. If unset, `https://gitlab.com` is used.

## Example

```python cookbook/91_tools/gitlab_tools.py theme={null}
from agno.agent import Agent
from agno.tools.gitlab import GitlabTools

agent = Agent(
    instructions=[
        "Use GitLab tools to answer repository questions.",
        "Use read-only operations unless explicitly asked to modify data.",
    ],
    tools=[
        GitlabTools(
            enable_list_projects=True,
            enable_get_projects=True,
            enable_list_merge_requests=True,
            enable_get_merge_request=True,
            enable_list_issues=True,
        )
    ],
)

agent.print_response(
    "List open merge requests for project 'gitlab-org/gitlab' and summarize the top 5 by recency.",
    markdown=True,
)
```

## Toolkit Params

| Parameter | Type | Default | Description |
| - | - | - | - |
| `access_token` | `Optional[str]` | `None` | GitLab access token. If not provided, uses `GITLAB_ACCESS_TOKEN`. |
| `base_url` | `Optional[str]` | `None` | GitLab instance URL. If not provided, uses `GITLAB_BASE_URL`, then `https://gitlab.com`. |
| `timeout` | `float` | `30` | HTTP timeout in seconds for API requests. |
| `enable_list_projects` | `bool` | `True` | Register the `list_projects` tool. |
| `enable_get_projects` | `bool` | `True` | Register the `get_project` tool. |
| `enable_list_merge_requests` | `bool` | `True` | Register the `list_merge_requests` tool. |
| `enable_get_merge_request` | `bool` | `True` | Register the `get_merge_request` tool. |
| `enable_list_issues` | `bool` | `True` | Register the `list_issues` tool. |
| `include_tools` | `Optional[list[str]]` | `None` | Optional inherited toolkit filter to include only specific tools. |
| `exclude_tools` | `Optional[list[str]]` | `None` | Optional inherited toolkit filter to exclude specific tools. |

## Toolkit Functions

| Function | Description |
| - | - |
| `list_projects` | List projects visible to the authenticated user. Supports search, owned, membership, and pagination filters. |
| `get_project` | Get details for one project by project ID or `group/project` path. |
| `list_merge_requests` | List merge requests for a project with state, branch, author, and pagination filters. |
| `get_merge_request` | Get details for one merge request by project and merge request IID. |
| `list_issues` | List project issues with state, labels, author, assignee, search, and pagination filters. |

Use the `enable_*` constructor toggles to register only selected GitLab tools. You can also use `include_tools` or `exclude_tools` to filter available tools. See [selecting tools](https://agno-v2.mintlify.site/tools/selecting-tools.md).

## Developer Resources

* [GitlabTools source](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/gitlab.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.