# Agent permissions

What an agent may read and change is decided by TKTail at every call, by choices only the user makes in TKTail. A
prompt, a configuration file, this documentation or the AI Agent Harness grants nothing: an agent that has all of them
still gets nothing until the user allows it in TKTail - and loses it the moment the user turns it off.

## What decides access

| Layer | Set by | What it decides |
|---|---|---|
| A running TKTail window | the user starts TKTail | Without one, the MCP server answers on its own: status, the formats and samples the agent sends - no sources. |
| **Allow AI access (MCP)** | the user: Settings > AI Access (MCP), or Tools > Allow AI Access (MCP) | Every tool that reads the window's sources. Off by default; turned off, the next call is refused. |
| The transport | the user's client configuration; HTTP also **Accept AI clients over HTTP** | stdio: every edition, the user's own Windows account. HTTP: Trial and Pro, off by default, a token on every request, this computer only unless the user chose the network. |
| The scope | the user: the tabs open in TKTail; **Tools > AI Investigation Roots...** | The Safe Workspace - what is open - for every edition; folders the user approved (Extended Investigation) for Trial and Pro. Never a path the agent invents, `..`, or a link out of an approved folder. |
| Permissions for changes | the user: four settings under **What AI clients may change** | Saving format profiles; saving and deleting Saved Searches and Metric Sets; managing alerts; saving evidence packages and pinning searches. Each off by default and only together with AI access. |
| The edition | the license | Metrics, Extended Investigation and HTTP are included with Trial and Pro ([Pricing](https://tktail.dev/pricing/)). |

The user sees what an agent did: its searches in Search Results (marked AI) and Jobs, its changes in Manage Alerts,
Saved Searches and the Metric Sets, and one line per answer in Output > Application - never the content
([What TKTail records](https://tktail.dev/help/mcp/#what-tktail-records)).

## Read-only and changing tools

Every tool reads, except those that change data - each of them needs its own permission and is annotated
`readOnlyHint: false`, so a client asks the user before calling it. Every tool needs AI access; the table lists what
some need beyond it, generated from the [MCP tool reference](https://tktail.dev/help/mcp-tools/) of this release.

| Tool | Changes data | Beyond AI access it needs | Note |
|---|---|---|---|
| `tktail_status` |  |  | answers without a running window for what it is given |
| `tktail_list_instances` |  |  | answers without a running window for what it is given |
| `tktail_list_sources` |  |  | answers without a running window for what it is given |
| `tktail_get_current_context` |  |  | answers without a running window for what it is given |
| `tktail_open_source` |  | Trial or Pro (Extended AI investigation (MCP)) | opens the file as a paused tab in the window |
| `tktail_get_records_around` |  |  | indexTimes: true starts a background time index of the source |
| `tktail_search` |  | a folder scope below an Investigation Root: Trial or Pro | starts an AI search session, shown in Search Results and Jobs (at most 5 kept) |
| `tktail_cancel_search` |  |  | stops one of the client's own searches (the user's searches answer not_allowed) |
| `tktail_list_saved_searches` |  |  | answers without a running window for what it is given |
| `tktail_run_saved_search` |  |  | starts a new AI search session from a copy of the Saved Search |
| `tktail_save_search` | yes | *Allow AI to save searches and Metric Sets*; paths below an Investigation Root: Trial or Pro |  |
| `tktail_delete_saved_search` | yes | *Allow AI to save searches and Metric Sets* |  |
| `tktail_validate_alert` |  | a metric alert or metric evidence: Trial or Pro |  |
| `tktail_save_alert` | yes | *Allow AI to manage alerts*; a metric alert or metric evidence: Trial or Pro |  |
| `tktail_set_alert_enabled` | yes | *Allow AI to manage alerts* |  |
| `tktail_delete_alert` | yes | *Allow AI to manage alerts* |  |
| `tktail_pin_search` | yes | *Allow AI to save evidence and pin searches* | pins or unpins a search: a pinned search is never closed to make room and is kept across a restart (a snapshot of its references in the data folder); an AI client cannot unpin the user's pin |
| `tktail_save_evidence` | yes | *Allow AI to save evidence and pin searches*; correlatedMetricSets: Trial or Pro; a destination folder below an Investigation Root: Trial or Pro | writes a redacted evidence package (a ZIP) into the Evidence Store (the data folder's Evidence folder), within its size limits; with destination also a copy below an Investigation Root |
| `tktail_delete_evidence` | yes | *Allow AI to save evidence and pin searches* | records a deletion REQUEST in the Evidence Store's catalog and tells the user; nothing is deleted until the user confirms it in TKTail |
| `tktail_list_metrics` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_current` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_history` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_summary` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_list_metric_sets` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_get_metric_set` |  | Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_save_metric_set` | yes | *Allow AI to save searches and Metric Sets*; Trial or Pro (Performance counters (Metrics)) |  |
| `tktail_delete_metric_set` | yes | *Allow AI to save searches and Metric Sets* |  |
| `tktail_list_formats` |  |  | answers without a running window for what it is given |
| `tktail_get_format` |  |  | answers without a running window for what it is given |
| `tktail_detect_format` |  |  | answers without a running window for what it is given |
| `tktail_preview_format` |  |  | answers without a running window for what it is given |
| `tktail_new_format_draft` |  |  | answers without a running window for what it is given |
| `tktail_validate_format` |  |  | answers without a running window for what it is given |
| `tktail_save_format` | yes | *Allow AI to save custom formats* |  |
| `tktail_list_investigation_roots` |  | to see the roots (without it the answer says Extended Investigation is not available): Trial or Pro |  |
| `tktail_discover_files` |  | Trial or Pro (Extended AI investigation (MCP)) |  |

Every other tool (14 of 50) reads the window's sources with AI access alone: `tktail_get_source_sample`, `tktail_get_record`, `tktail_get_search`, `tktail_get_search_results`, `tktail_aggregate`, `tktail_get_saved_search`, `tktail_list_alerts`, `tktail_get_alert`, `tktail_list_alert_occurrences`, `tktail_get_alert_occurrence`, `tktail_get_occurrence_evidence`, `tktail_list_evidence`, `tktail_get_evidence`, `tktail_verify_evidence`.

## Refusals

A refusal is a tool result with `isError: true` and `structuredContent.error` `{category, message}`; the message says
what the user can do. Tell the user - do not retry the same call, and never work around it.

| Category | Meaning |
|---|---|
| `invalid_arguments` | an argument is missing, of the wrong type or unknown |
| `access_off` | the user has not allowed AI access (mcp.allowWindow) |
| `capability_unavailable` | the license does not include the capability (Metrics, Investigation Roots, HTTP) |
| `unavailable` | no running TKTail window, not the Primary, or it is closing |
| `busy` | the window did not answer in time, or a bound was reached - retry later |
| `source_not_found` | no open source with this sourceId |
| `stale_source` | the reference belongs to an older state of the source |
| `not_found` | no such search, saved search, metric set, format, event or metric |
| `no_context` | nothing is selected in the window |
| `scope_not_allowed` | the path is neither an open source nor below an approved Investigation Root |
| `unsupported` | the source kind cannot answer this (e.g. a Metrics View as a record source) |
| `not_allowed` | the user's consent for this change is off, or the object is the user's own |
| `conflict` | the stored version or content changed - read it again |
| `time_not_indexed` | the source has no time index yet (indexTimes starts one) |
| `time_indexing` | the time index is being built |
| `no_record_times` | the source's records have no timestamps |
| `response_too_large` | the answer exceeds the response budget - ask for fewer items |
| `internal` | an unexpected failure |

Protocol errors (a malformed request, an unknown method or tool, an unsupported protocol revision) are JSON-RPC errors
instead - their codes are in the developer reference (docs/MCP.md).

## What no permission allows

- Running commands, programs, scripts or a terminal; reading the registry, services or settings; changing settings.
- Reading, listing or writing files outside the sources open in TKTail, the Investigation Roots and TKTail's own stores
  (format profiles, Saved Searches, Metric Sets, alerts).
- Adding, enabling or removing an Investigation Root - only the user does that.
- Deleting, acknowledging or exporting incidents; changing a built-in format, a built-in Metric Set or a `.tktail` file.
- Starting collection of performance counters TKTail does not already collect.
- Overwriting the user's changes: a change names the version it read and is refused (`conflict`) if the object changed.

---

The HTML page: https://tktail.dev/help/ai-agents-permissions/
