Skip to main content
Glama

Read history

read_history
Read-only

Read recent history entries, search them, or read one entry whole.

Instructions

Read recent history entries, search them, or read one entry whole.

- Without ``query``: up to ``limit`` newest entries; ``since`` (ISO8601
  prefix) keeps entries at or after it.
- With ``query``: the semantically nearest entries with cosine distance;
  the index is built on first use and rebuilt when history.md or the
  embedding configuration changes.
- ``offset`` skips that many of the newest (or nearest) entries first.
- With ``entry_id``: that entry with its full text, also an archived one;
  the other arguments are ignored.

A listing stays under Claude Code's 50,000-character result limit: outcome
up to 600 characters, intent and action up to 300, files and tags up to 20
items, and ``truncated`` gives a shortened entry's full lengths. If that is
still too long, previews shrink and the last entries are left out
(``omitted``; ``instruction`` says how to read them).

With user library sync, the entries the user's machines shared for this
repository are merged in, one per entry hash; ``machine`` keeps one
machine label's entries, or ``local`` this checkout's own.

Without a project, it reads the installation's fallback journal (#292):
the entries kept for the same claimed directory, ``query`` as a text match.

Returns JSON: {entries, total, mode, omitted?, instruction?, workspace,
workspace_note? (a workspace argument outside the registered root was ignored),
pid, history_last_error?}; mode is recency, semantic or entry. Entries
(machine: null for this checkout's own):
- recency and entry: {id, timestamp, intent, action, outcome, files, tags, metadata, machine}.
- semantic: {id, distance, timestamp, intent, action, outcome, tags, machine}.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "read_history"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
queryNoOptional text to search the history for.
sinceNoOptional ISO8601 prefix; only entries at or after it.
offsetNoEntries to skip first, newest or nearest first.
machineNoOptional machine label, or `local` for this checkout's own entries.
entry_idNoOptional id of one entry to return whole; the other arguments are then ignored.
workspaceNoAbsolute path of your working directory, the project this session works in. Pass it whenever you have one. It never widens this session's grant: over HTTP the workspace registered for the connection decides, and over stdio it is checked against the client's own MCP roots unless this session's root is already pinned, when it is ignored. Each tool's description says what it does with a path that grant does not cover.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv26.10.18
    • changedInput schema / properties / workspace / description
      Previous value: -"Absolute path of your working directory, the project this session works in. Pass it whenever you have one: one server can serve several sessions."New value: +"Absolute path of your working directory, the project this session works in. Pass it whenever you have one. It never widens this session's grant: over HTTP the workspace registered for the connection decides, and over stdio it is checked against the client's own MCP roots unless this session's root is already pinned, when it is ignored. Each tool's description says what it does with a path that grant does not cover."
  2. First observedv26.10.14+1807

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnly/openWorld annotations it discloses real operational traits: the embedding index is built on first use and rebuilt when history.md or the embedding config changes, listing output is capped under a 50,000-character limit with per-field truncation and ``omitted``/``instruction`` fallbacks, and sync merges remote entries by hash. The ``workspace`` note about ignored paths outside the registered root is exactly the kind of side-effect disclosure that matters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Bullets are front-loaded and each rule is scoped to a mode, which keeps a dense description navigable. But the closing paragraph re-specifies the full JSON return shape and per-mode entry fields even though an output schema exists, so a meaningful share of the text is duplicated structured data rather than added meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter, multi-mode read tool with sync and fallback paths, the description covers mode selection, truncation, indexing cost, machine filtering, and the workspace-ignored case. An agent has everything needed to invoke it correctly and interpret the response.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 86%, so the baseline is 3; the description earns above that by explaining the interaction rules the schema cannot (``entry_id`` overrides all other arguments, ``offset`` applies to newest-or-nearest order, ``query`` switches to cosine distance with a text-match fallback in the no-project journal). Most individual parameter meanings, however, largely restate the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence states a specific verb plus resource and enumerates the three distinct modes (list, semantic search, single entry). Each mode is then tied to a concrete argument, so an agent can predict the behavior without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear condition-to-mode mapping: no ``query`` for a recency listing, ``query`` for cosine-nearest search, ``entry_id`` for one full entry with the other arguments ignored, and a documented fallback journal when no project exists. What it lacks is any statement of when *not* to use this tool or a named alternative for history-like reads.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.