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

# Dynatrace

> Connect a Dynatrace environment so agents can run DQL, investigate open problems, review vulnerabilities, and find affected entities

Connect a Dynatrace environment to let CloudThinker agents list open problems, run DQL (Dynatrace Query Language) against logs, metrics, spans, and events in Grail, review vulnerabilities, and find the entities a problem touches. The connection uses the official Dynatrace MCP server, signed in with one **platform token** for one environment.

## Prerequisites

* A Dynatrace SaaS environment on the Dynatrace Platform (Grail), with the data you want agents to read. Dynatrace Managed and classic environments with no `apps.dynatrace.com` address can't connect.
* A Dynatrace user (or service user) in that environment's account who can read the data agents should query. Any account member can create a platform token, but the token only gets that user's permissions.
* Your environment URL in the Platform format: `https://<environment-id>.apps.dynatrace.com`.

## Setup

**1. Find your environment URL**

Sign in to Dynatrace and copy the address from your browser up to `.apps.dynatrace.com`, for example `https://abc12345.apps.dynatrace.com`.

Use the `apps.dynatrace.com` address, not a classic `live.dynatrace.com` one. The MCP server only talks to Platform APIs.

**2. Create a platform token**

Open **My platform tokens** in your Dynatrace account ([myaccount.dynatrace.com/platformTokens](https://myaccount.dynatrace.com/platformTokens)) and select **Platform token**. Set:

* **Token name**: `cloudthinker`
* **Expiration date**: a lifetime that matches your rotation policy
* **Environments**: the environment you found in the previous step, unless you apply the token to the whole account
* **Scopes**: `app-engine:apps:run` plus the read scopes for the data you want agents to query (see [Required permissions](#required-permissions))

Click **Generate** and copy the token. Dynatrace shows it only once. The token can only do what its user is allowed to do, so create it as a user (or a service user) that can read that data.

**3. Add the connection in CloudThinker**

Open **More → Workspace settings → Connections**, stay on the **Builtin Connections** tab, and select **Dynatrace**. Fill in:

* **DT\_ENVIRONMENT**: your environment URL
* **DT\_PLATFORM\_TOKEN**: the token you just created

Click **Connect**.

**Success state:** Dynatrace shows **Connected**. Run the verify prompt below to confirm the token can read your environment.

> [!WARNING]
>
> Use a **platform token**, not a classic Dynatrace API token. Classic API tokens don't carry the Platform scopes the MCP server needs, so most requests fail with 401 or 403.

## Connection details

| Field | Description | Example |
| - | - | - |
| **DT\_ENVIRONMENT** | Dynatrace Platform environment URL | `https://abc12345.apps.dynatrace.com` |
| **DT\_PLATFORM\_TOKEN** | Platform token for that environment | `<your-platform-token>` |

To reach another environment, add it as a separate connection with its own token.

## Required permissions

Start with `app-engine:apps:run` and add only the read scopes for the data types agents should query.

| Scope | What it enables |
| - | - |
| `app-engine:apps:run` | Required. Runs the Dynatrace MCP tools |
| `storage:buckets:read` | Discover the Grail buckets the token can read |
| `storage:logs:read` | Query logs with DQL |
| `storage:metrics:read` | Query metrics with DQL |
| `storage:spans:read` | Query traces and spans with DQL |
| `storage:events:read` | Query events with DQL |
| `storage:entities:read` | Query monitored entities with DQL |
| `storage:smartscape:read` | Query Smartscape topology with DQL |
| `storage:security.events:read` | Query security events with DQL |
| `storage:bizevents:read` | Query business events with DQL |
| `storage:user.events:read` | Query user events with DQL |
| `storage:user.sessions:read` | Query user sessions with DQL |
| `storage:system:read` | Query system data with DQL |
| `storage:files:read` | Use lookup data in DQL `load` statements |
| `document:documents:write` | Optional. Lets agents create a Dynatrace notebook |

The optional tools need extra scopes. Add only the ones you want agents to use:

| Tool | Extra scopes |
| - | - |
| Davis analyzers | `davis:analyzers:read` to list them, `davis:analyzers:execute` to run one |
| DQL help | `davis-copilot:nl2dql:execute` (question to DQL), `davis-copilot:dql2nl:execute` (explain a query) |
| Send an event | `storage:events:write` |
| Send an email | `email:emails:send` |

The full list is in the [Dynatrace MCP server README](https://www.npmjs.com/package/@dynatrace-oss/dynatrace-mcp-server).

> [!TIP]
>
> If DQL works for one data type and fails for another, the token is missing that type's `storage:*:read` scope. Add it in Dynatrace and update the token in the connection.

## Agent capabilities

| Capability | What agents can do | Approval |
| - | - | - |
| **Environment check** | Confirm the connection and read basic environment info | No |
| **Problems** | List open and recent problems and the services or hosts they affect | No |
| **Vulnerabilities** | List vulnerabilities, filtered by risk score, such as 7.0 and above | No |
| **Entities** | Find monitored entities by name | No |
| **DQL** | Validate a query, then run it with a small record limit | No |
| **DQL help** | Turn a plain-language question into DQL, or explain an existing query (needs extra scopes) | No |
| **Kubernetes events and exceptions** | List Kubernetes events for a cluster or workload, and recent exceptions | No |
| **Davis analyzers** | List the available Davis analyzers and run one on a time window (needs extra scopes) | No |
| **Notebooks** | Create a Dynatrace notebook with the findings | Yes |
| **Notifications and events** | Send an email through Dynatrace, send an event, or create a notification workflow (needs extra scopes) | Yes |

Agents validate each DQL query before running it and start with 50 to 100 records. That matters for cost: DQL queries scan Grail data, which can count toward your Dynatrace consumption (see [Dynatrace pricing](https://www.dynatrace.com/pricing/)). The MCP server also keeps a **Grail query budget**, a running total of the data its queries scan, and stops queries once it's used up. Every write goes through [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md), and a rejected call isn't retried.

### Verify the connection

```text theme={null}
Run Dynatrace discovery and list open problems and high-risk vulnerabilities
```

Expect your environment info, the open problems with their affected entities, and any vulnerabilities with a risk score of 7.0 or higher. If the token has the Davis scopes, the list of Davis analyzers appears too.

### Example prompts

```text theme={null}
Which Dynatrace problems are open in production right now, and which services do they affect?
Query Dynatrace logs for errors from the checkout service in the last 30 minutes
List Dynatrace vulnerabilities with a risk score of 7 or higher on internet-facing services
Show the Kubernetes events for the payments workload in the last hour
```

Name a service, entity, or bucket and a short time window in large environments. Narrow queries return faster and use less Grail budget.

## Troubleshooting

> [accordion] Connect fails or every request returns 401
>
> The token is missing, expired, revoked, or a classic API token. Create a new platform token with `app-engine:apps:run`, edit the connection, and paste it into **DT\_PLATFORM\_TOKEN**. Also check that **DT\_ENVIRONMENT** uses `apps.dynatrace.com`, not `live.dynatrace.com`.

> [accordion] Some queries return 403
>
> The token lacks the scope for that data type. For example, log queries need `storage:logs:read`. Add the scope in Dynatrace and update the connection.

> [accordion] A DQL query returns no rows
>
> The query may target a bucket the token can't read, a time range with no data, or a misspelled entity. Ask the agent to find the entity by name first, then rerun the query on a known service and a short window.

> [accordion] Requests return 429
>
> The Grail query budget is used up. Ask the agent to reset it (a reset goes through Approvals like any write), then narrow the time window and record limit so the next queries scan less.

> [accordion] An entity or problem isn't found (404)
>
> The entity was renamed or the id is wrong. Ask the agent to look it up by name instead of by id.

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- **Platform token, read scopes first**: add `document:documents:write` or any notification scope only if you want agents to create notebooks or send messages through Dynatrace.
- **One token per connection**: create a token used only by CloudThinker so you can revoke it without breaking other tools.

## Related

> [card] [Root cause analysis](https://docs.cloudthinker.io/guide/incident/root-cause-analysis.md)
>
> See how Resolve uses observability data to find what broke.

> [card] [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md)
>
> Control which Dynatrace writes wait for a person.


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