Skip to main content
Glama

unflatten_session

Restores a flattened session to its original pre-flatten state by re-inlining tool results from the backup, then removes the backup.

Instructions

Reverse a flatten: re-inline every flattened tool result (text and images) back into the session JSONL from the backup, restoring the session to its pre-flatten state, then delete the backup so nothing is left behind.

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_idYesSession UUID, "last", or "current" (the live session)
project_dirNoAbsolute path to project. Default: the project the CLI runs in (cwd)
Behavior3/5

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

No annotations exist, so the description carries the full burden. It discloses the destructive action of deleting the backup, but does not mention potential failure modes (e.g., missing backup), required permissions, or other side effects. This is adequate but not comprehensive.

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 two-sentence description is concise and front-loaded with the core verb. Every phrase adds value, and there is no unnecessary repetition.

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?

Given moderate complexity, the description covers the main purpose and side effect (backup deletion). However, it lacks information about return values or what happens if the backup does not exist, which would improve completeness.

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

Parameters3/5

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

Schema description coverage is 100%, so baseline is 3. The description adds no additional meaning beyond what the schema already provides for the three parameters (session_id, claude_dir, project_dir). No parameter-specific guidance is given.

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 verb ('reverse a flatten', 're-inline') and resource ('session JSONL from the backup'), and it distinguishes the tool from siblings like flatten_session and unflatten_messages by specifying it restores the session to its pre-flatten state and deletes the backup.

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

Usage Guidelines3/5

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

The description implies the tool should be used after flatten_session but does not explicitly state when to use it versus alternatives like unflatten_messages. No exclusion criteria or context about prerequisites are provided, leaving the agent to infer usage from the verb.

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