> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool authorizations (Experimental)

> How to control which tools each role can use in Atoti Intelligence with the experimental `atoti.server.authorizations`: the system property it needs, statement syntax, defaults, and what each resource and action authorizes.

> [!NOTE]
>
> ### Atoti Intelligence Essentials
>
> This is part of the Atoti Intelligence Essentials offer.

> [!WARNING]
>
> `atoti.server.authorizations` is experimental and may change in future versions without notice.

Each gated tool declares a resource and an action, such as `calculatedMember:create`. `atoti.server.authorizations` states which roles may use which pairs, so a pair stands for a capability. It replaces the `atoti.ai.tools.*` properties of Atoti Intelligence 6.2.2 and 6.2.3.

It gates the Atoti Intelligence chat and content tools. [What each resource and action authorizes](#what-can-each-resource-and-action-authorize) lists the capabilities. It does not gate tools you add to your application.

A denied tool is hidden from the chat's tools, tool search and the MCP `tools/list` response, and refused if called.

## When is the system property required?

Setting `atoti.server.authorizations`, even to an empty list, requires the JVM system property `-Dactiveviam.feature.experimental.authorizations.enabled=true`, or the application fails at startup. It cannot go in `application.yml`.

When `atoti.server.authorizations` is not set, the defaults apply without it.

## How a statement is written

`atoti.server.authorizations` is a list of statements, each with three required keys:

| Key | Content |
| - | - |
| `roles` | Roles the statement applies to, such as `ROLE_USER`. None may be blank. |
| `effect` | `ALLOW` or `DENY`. |
| `authorization` | A non-empty list of `<resource>:<action>` entries. |

The resources are those of the installed tools. Naming a resource no installed tool acts on stops the startup. The actions are `create`, `read`, `update` and `delete`. See [what each resource and action authorizes](#what-can-each-resource-and-action-authorize) for the capability behind each pair.

`*` stands for a whole resource or action: `*:create`, `calculatedMember:*` and `*:*` are valid, `calc*:read` is not. In YAML, quote the entry: an unquoted `*` is read as an alias.

## How statements combine

A user can use a tool only if a statement matching one of their roles allows it and none denies it. Roles add up: a user with several roles gets the statements of all of them.

For example, with three roles:

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  server:
    authorizations:
      - roles: [ROLE_ABC]
        effect: DENY
        authorization:
          - calculatedMember:delete
      - roles: [ROLE_USER]
        effect: ALLOW
        authorization:
          - calculatedMember:create
      - roles: [ROLE_ADMIN]
        effect: ALLOW
        authorization:
          - calculatedMember:read
          - "*:*"
```

The outcomes are:

| Roles of the user | Tools the user can use |
| - | - |
| `ROLE_USER` | Only creating calculated members (`calculatedMember:create`) |
| `ROLE_USER` and `ROLE_ADMIN` | Every tool |
| `ROLE_ADMIN` and `ROLE_ABC` | Every tool except `calculatedMember:delete`: the `DENY` of `ROLE_ABC` wins over the `*:*` of `ROLE_ADMIN` |
| `ROLE_ABC` alone | No tool: no statement allows one |

## What is the default behavior out of the box?

When the property is not set, these statements apply:

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  server:
    authorizations:
      - roles: [ROLE_USER, ROLE_ADMIN]
        effect: ALLOW
        authorization:
          - "*:read"
          - autoExplain:create
          - autoExplain:delete
          - chatHistory:delete
```

`ROLE_USER` and `ROLE_ADMIN` can use every `read` capability, run, find and remove Auto-Explain results, and clear the chat history. No tool that creates, updates or deletes anything else is allowed, such as creating or changing calculated members, or creating dashboards.

Setting the property replaces the defaults: restate them to keep them, without the entries of tools the server does not install.

## How to grant more tools

To also let `ROLE_ADMIN` create, update and delete calculated members, restate the defaults and add a statement:

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  server:
    authorizations:
      - roles: [ROLE_USER, ROLE_ADMIN]
        effect: ALLOW
        authorization:
          - "*:read"
          - autoExplain:create
          - autoExplain:delete
          - chatHistory:delete
      - roles: [ROLE_ADMIN]
        effect: ALLOW
        authorization:
          - "calculatedMember:*"
```

## How to switch every gated tool off

An empty list denies every tool that the server installs to every role:

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  server:
    authorizations: []
```

An empty `authorizations:` node does the same.

## What can each resource and action authorize?

A statement names a resource, which is a kind of object the chat and MCP tools work on, and an action, which is what a tool does to it. The actions mean:

| Action | Meaning |
| - | - |
| `create` | Run something new or add an object: start an analysis, create a calculated member or a dashboard. |
| `read` | Look at existing objects or results without changing anything. |
| `update` | Change or move an existing object. |
| `delete` | Remove an object or erase stored data. |

Each resource supports only some of these actions:

| Resource | What it covers | Actions |
| - | - | - |
| `autoExplain` | Auto-Explain analyses. | `create` runs an analysis. `read` retrieves past results. `delete` removes a result. |
| `calculatedMember` | Calculated members on a cube. | `create` adds one. `read` retrieves one. `update` changes one. `delete` removes one. |
| `chatHistory` | The history of the user's chat. | `delete` clears it. |
| `connectedServer` | Information about the connected MCP servers. | `read` reports which servers are available. |
| `cube` | The structure of a cube: dimensions, hierarchies, levels, measures and members. | `read` discovers the structure. |
| `dashboard` | Dashboards in the Content Server. | `create` creates a dashboard. `read` lists, searches and retrieves dashboards and their schema. `update` changes or moves a dashboard. `delete` removes one. |
| `mdxQuery` | MDX queries. | `read` runs a query. |

The `dashboard` resource needs a Content Server. Only `calculatedMember` and `dashboard` support `update`.

## How to set the property from environment variables

Spring's indexed form addresses each statement and each `roles` and `authorization` entry by position. These variables allow every tool to `ROLE_USER`:

* `ATOTI_SERVER_AUTHORIZATIONS_0_ROLES_0=ROLE_USER`
* `ATOTI_SERVER_AUTHORIZATIONS_0_EFFECT=ALLOW`
* `ATOTI_SERVER_AUTHORIZATIONS_0_AUTHORIZATION_0=*:*`

A source of higher priority, such as an environment variable or a profile, replaces the whole list of the lower sources. Only the winning list is checked and applied.

## What makes the application fail to start?

A mistake in a statement stops the startup with an error naming the faulty entry:

* A statement key other than `roles`, `effect` or `authorization`, such as `role`.
* A resource that no installed tool acts on.
* An unknown action or effect.
* A partial wildcard, such as `calc*:read`.
* An entry with no `:` or several.
* A missing or empty `roles`, `effect` or `authorization`.
* A blank role.

## Related reading

* [Retries and timeouts](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/retries-and-timeouts.md) bounds how long and how often a prompt calls tools.
