Skip to main content
Glama

Retrieve flattened content

retrieve_flattened
Read-onlyIdempotent

Retrieve original tool result content from a flattened session backup by specifying the tool use ID and session ID from the conversation.

Instructions

Retrieve original tool result content from a flattened session, read straight from its backup. When you see [FLATTENED id=XXX tool=Read ... | text NNNB/NNL | session=YYY | ...] in the conversation, call this with the value after "id=" as tool_use_id and the value after "session=" as session_id, and set agent to match the session ("claude" default, or "codex"). Returns the original text output, or — for flattened screenshots (claude) — the actual image so you can view it again.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentNoWhich agent's session store the flattened session lives in: "claude" (default) or "codex".claude
claude_dirNoAbsolute path (or ~/...) to the Claude config dir whose sessions to target — the dir holding projects/, e.g. ~/.claude-2 for a second profile. Default: $CLAUDE_CONFIG_DIR if set, else ~/.claude. Applies to agent "claude" only.
codex_homeNoAbsolute path (or ~/...) to the Codex home whose sessions to target — the dir holding sessions/. Default: $CODEX_HOME if set, else ~/.codex. Applies to agent "codex" only.
session_idYesValue after "session=" in the [FLATTENED ... session=YYY ...] marker
project_dirNoAbsolute path to project. Default: the project the CLI runs in (cwd). Ignored under codex (rollouts are located by UUID globally).
tool_use_idYesValue after "id=" in the [FLATTENED id=XXX ...] marker

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindYes"text", "image", or "mixed".
slotYes"content"/"toolUseResult" (claude) or "output" (codex).
tool_nameYesOriginating tool name of the retrieved result.
line_countYesLine count of the original text projection.
tool_use_idYesThe tool_use_id that was retrieved.
original_sizeYesByte size of the original content.
Behavior5/5

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

Annotations already declare readOnlyHint and idempotentHint. The description adds valuable context: it reads 'straight from its backup', returns original text output, and for flattened screenshots (claude) returns the actual image for viewing. No contradictions with annotations.

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

Conciseness5/5

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

The description is efficient and front-loaded, starting with the core purpose then immediately giving usage instructions. Every sentence adds value—no filler. It's appropriately sized for the tool's complexity.

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?

Given the tool has 6 parameters (2 required), a complex trigger pattern, and an output schema, the description covers all necessary aspects: trigger identification, parameter extraction, agent selection, default paths, and return types. The output schema exists and the description hints at what is returned (text or image), making it complete.

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 100% with descriptions for all 6 parameters. The description adds extra meaning beyond the schema by explaining how to derive parameters from the FLATTENED marker (e.g., 'value after id=') and providing context for agent and directory defaults.

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 description clearly states the tool retrieves original tool result content from a flattened session, with a specific verb ('Retrieve') and resource ('original tool result content from a flattened session'). It distinguishes from sibling tools like flatten_session by explaining the use case of reading previously flattened content.

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

Usage Guidelines5/5

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

The description explicitly tells when to use the tool: when a [FLATTENED ...] marker appears in the conversation. It provides step-by-step instructions on extracting tool_use_id and session_id from the marker, setting the agent, and default values.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shayaShav/flatten-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server