Skip to main content
Glama

retrieve_flattened

Retrieve the original tool output from a flattened session by providing the session ID and tool use ID found in the [FLATTENED] marker. Returns the full text or image.

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. Returns the original text output, or — for flattened screenshots — the actual image so you can view it again.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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 (so a server running inside an alternate profile targets it), else ~/.claude.
session_idYesValue after "session=" in the [FLATTENED ... session=YYY ...] marker
project_dirNoAbsolute path to project. Default: the project the CLI runs in (cwd)
tool_use_idYesValue after "id=" in the [FLATTENED id=XXX ...] marker
Behavior4/5

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

Discloses return type: original text or image for screenshots. Says 'read straight from its backup', implying read-only operation. No annotations provided, so description carries full burden; limited on error conditions or permissions.

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?

Two sentences, no wasted words. Critical information front-loaded: what it does, how to extract parameters, what it returns.

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

Completeness4/5

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

Covers usage, parameter extraction, and output types (text or image). Could mention error handling or that only works for previously seen markers, but overall sufficient given 4 parameters and no output schema.

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 100% (baseline 3). Description adds value by explaining parameter derivation from marker format for tool_use_id and session_id, and mentions default behaviors for claude_dir and project_dir.

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, specifically 'read straight from its backup'. It distinguishes from sibling tools (flatten, unflatten) by focusing on retrieval.

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?

Explicit instructions: call this when seeing a '[FLATTENED id=XXX tool=Read ... session=YYY ...]' marker, extracting 'tool_use_id' from 'id=' and 'session_id' from 'session='. No ambiguity about when to use.

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