Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Agent quickstart

Every investigation with TKTail follows one loop: discover what is there, inspect the record in question, narrow the evidence with TKTail’s search, correlate it across sources and time, and report it with its source and position. The calls below are complete tools/call parameters - the tool’s name and its arguments, checked against the tools TKTail serves; replace the values in angle brackets with what TKTail returned. Connecting first: Turn it on, Connect any MCP client.

1. Discover

Ask TKTail what it is and what is open - never guess paths or ids.

{ "name": "tktail_status", "arguments": {} }

tktail_status names the version, the edition and what the license allows (license, features), whether a TKTail window answers (connection), the investigation scope (investigationScope: safeWorkspace, or safeWorkspace+extended with Investigation Roots) and the limits of the answers. Without a window (connection.mode standalone) only status, formats and samples you send can be answered: ask the user to start TKTail and open the logs.

{ "name": "tktail_list_sources", "arguments": {} }

The open logs, event logs and Metrics Views, each with a sourceId (src-...), its format, size and time range. Ids and evidence references are valid while that TKTail runs: list again after a restart.

2. Inspect

Start from what the user is looking at, then widen around it.

{ "name": "tktail_get_current_context", "arguments": {} }

The current record of the view in front - the whole multi-line entry, its time, fields and Summary, and an evidenceRef. contextKind none: nothing is selected - ask the user to click into a log.

{ "name": "tktail_get_records_around", "arguments": { "anchor": "current", "before": 10, "after": 10 } }

The records before and after it, in the order of the source. Any evidenceRef TKTail returned works as the anchor - pass it back unchanged. One whole record: tktail_get_record with that evidenceRef.

3. Narrow

Search with TKTail instead of reading files: a field condition where the format has the field, text or a regular expression otherwise, a time range when the question has one.

{
  "name": "tktail_search",
  "arguments": {
    "definition": {
      "sources": [{ "kind": "open" }],
      "predicate": { "all": [{ "field": { "name": "requestId", "op": "eq", "value": "<request id>" } }] }
    },
    "maxResults": 50
  }
}

The answer has a searchId, its state, counts and the first results, each with an evidenceRef. A search still running continues in TKTail: tktail_get_search waits for it, tktail_get_search_results pages through every result (offset, nextOffset, hasMore). The search is listed in the user’s Search Results, marked AI.

{ "name": "tktail_get_search_results", "arguments": { "searchId": 19, "offset": 50, "maxResults": 50 } }

Ask for what the question needs, not for every record:

  • How many? - "maxResults": 0: the counts only.
  • Which values? - "fields": ["c-ip", "cs-uri-stem", "sc-status"], "preview": false: each result with only those fields (values, null where a record has none) - a page of 100 results stays small.
  • Who, how often, how slow? - "aggregate" in tktail_search: the search groups, counts and sums EVERY match as it finds it - also the matches beyond the 5,000 results it stores - and the answer’s aggregate has the top groups, a histogram and number summaries: a few kilobytes instead of thousands of records. For a question after the search, tktail_aggregate analyzes the results it stored (covers: storedResults).
{
  "name": "tktail_search",
  "arguments": {
    "definition": { "sources": [{ "kind": "open" }], "predicate": { "all": [{ "field": { "name": "sc-status", "op": "ge", "value": "500" } }] } },
    "maxResults": 0,
    "waitMs": 5000,
    "aggregate": { "groupBy": ["c-ip"], "top": 10, "bucket": "1m", "number": "time-taken" }
  }
}
{
  "name": "tktail_aggregate",
  "arguments": {
    "searchId": 19,
    "groupBy": ["c-ip"],
    "top": 10,
    "bucket": "1m",
    "number": "time-taken"
  }
}

A key or the number is a field name, or a value mapping as in sequence correlation - for a log without that field: {"input": "text", "extract": "regex", "pattern": "elapsed: (?<ms>\\d+(\\.\\d+)?)ms", "group": "ms"}. Read covers, complete and caveats before you report: aggregate in a search covers every match (allMatches); tktail_aggregate covers the results the search stored (5,000 by default), and rows whose log changed since the search are unreadable; more than 10,000 distinct keys are counted, not grouped. Each top group has firstResultIndex and an evidenceRef to show the user. The histogram lists every bucket that has rows: one-minute buckets over a day of log are more than a thousand entries (1,620 buckets were a 79,000-character answer, which an AI client may set aside instead of reading). For “the busiest minutes”, group by the minute with top - a key {"input": "field", "field": "time", "extract": "substring", "index": 0, "length": 5, "name": "minute"} for IIS - or use a coarser bucket (1h). A number condition finds the rows themselves: {"number": {"input": "text", "extract": "regex", "pattern": "elapsed: (?<ms>\\d+(\\.\\d+)?)ms", "group": "ms", "op": "ge", "value": 1000}} inside the predicate.

4. Correlate

Relate evidence in time and across sources: the records around a result, the records near a time, a sequence of steps tied by a key, the metrics of the same minute.

{ "name": "tktail_get_records_around", "arguments": { "sourceId": "<sourceId>", "time": "2026-10-08T10:00:01", "beforeSeconds": 30, "afterSeconds": 30, "indexTimes": true } }

The records within 30 seconds of a time - with time alone, the record nearest it, as Edit > Go To Time finds it. A time needs the file’s record times: until TKTail has read them the answer is time_not_indexed, and "indexTimes": true lets TKTail read them in the background (as View > Read the File’s Times) - while it does, the answer is time_indexing: ask again shortly. A sequence search relates steps in time - X, then within a window Y, tied by a key such as a request id: A request: where did it fail?. Metrics of the same time (Trial and Pro): Performance.

5. Report

  • Quote evidence with its source and position (the source name, the line, the record’s own time) and keep the evidenceRef with it, so the user - or the next call - can go back to it.
  • Say when evidence may be missing: a search with evidenceMayBeMissing: true or a state incomplete, cancelled or failed, a value marked truncated, an incident item that is partial. Never present such a result as complete.
  • Name the TKTail that answered by the answer’s own source - nodeId (this TKTail’s data folder) and instanceId (this run) - never by an earlier call: a restart is a new run, another computer another node. displayName, nodeName and instanceName are labels, not keys; an incident’s origin is the run that captured it, which may not be the one answering (Which TKTail answered).
  • Propose changes; make them only with the user’s consent and the permission they need (Agent permissions).

Rules for agents

  • Read what is there before writing; never invent paths - use tktail_list_sources, and with Extended Investigation tktail_list_investigation_roots / tktail_discover_files.
  • Ask the user before any change. Writing tools are annotated readOnlyHint: false; check first with tktail_validate_format and tktail_validate_alert - they need no permission and write nothing.
  • On a refusal, tell the user what it says and what they can do - do not retry the same call (Refusals).
  • Stay within the bounds: count, project or aggregate before you page; page long results instead of asking for everything; every answer stays within 256 KiB.
  • TKTail has no tool for commands, programs, settings, or files outside its stores and the Investigation Roots - do not look for one.