Skip to main content
Glama

Session Snapshot

session_snapshot
Destructive

Save, restore, list, or delete session workspace snapshots. Snapshots are stored outside the workspace to prevent tampering, and restore files into a new or existing session.

Instructions

Archive or restore a session's workspace files. action:

  • "save": tar.gz the session's current files (same rules as session_artifacts: .codecalc-run/ excluded, symlinks/hardlinks refused) into a snapshot stored OUTSIDE the workspace, so sandboxed code can never read or tamper with it. Returns snapshot_id.

  • "restore": extract snapshot_id's files into a brand-new session (default) or, with replace=True, wipe and recreate session_id's OWN workspace first. Only files are restored — a python3/node session's REPL variables/imports are never part of a snapshot.

  • "list": snapshots saved for session_id, oldest first.

  • "delete": remove one snapshot (snapshot_id required).

Snapshots are deleted when their session is stopped (session_stop(keep_snapshots=True) to keep them).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelNoOptional human-readable label to store with a new snapshot; only used by action='save'
actionNoOne of 'save', 'restore', 'list', 'delete'; default 'save' archives the workspacesave
replaceNoFor action='restore', wipe and reuse session_id's own workspace instead of creating a new session
session_idYesId of the session the snapshot belongs to or is restored into
snapshot_idNoId of an existing snapshot; required for action='restore' or action='delete'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.12.0
    • addedInput schema / properties / action / description
      Added value: +"One of 'save', 'restore', 'list', 'delete'; default 'save' archives the workspace"
    • addedInput schema / properties / label / description
      Added value: +"Optional human-readable label to store with a new snapshot; only used by action='save'"
    • addedInput schema / properties / replace / description
      Added value: +"For action='restore', wipe and reuse session_id's own workspace instead of creating a new session"
    • addedInput schema / properties / session_id / description
      Added value: +"Id of the session the snapshot belongs to or is restored into"
    • addedInput schema / properties / snapshot_id / description
      Added value: +"Id of an existing snapshot; required for action='restore' or action='delete'"
  2. Addedv0.11.0

TDQS

A5/5.0
Behavior5/5

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

The description discloses key side-effects and constraints beyond annotations: snapshots are stored outside the workspace (so sandboxed code cannot read/tamper), restore never includes REPL variables/imports, and snapshots are deleted when their session stops. This adds context to the destructiveHint annotation and clarifies scope of restore.

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 compact yet precise, using a bulleted action list to organize behaviors without redundancy. It packs essential details (exclusions, storage location, lifecycle) into minimal prose, making it easy for an agent to parse and apply.

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?

The description covers the full lifecycle, integration with sibling tools (session_artifacts, session_stop), and edge cases (restore into new vs existing session). With an output schema present and high schema coverage, no information an agent needs to call this tool correctly is missing.

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

Parameters5/5

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

All five parameters are fully described in the schema, including conditional requirements (snapshot_id for restore/delete), defaults (action='save', replace=False), and scope (label only for save). The description reinforces these by tying each parameter to specific actions, ensuring no ambiguity.

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 explicitly states the tool archives or restores session workspace files and enumerates four actions (save, restore, list, delete) with distinct behaviors. It clearly distinguishes from sibling tools like session_artifacts by referencing its rules, and from session_stop by referencing snapshot lifecycle.

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 provides explicit action-specific guidance: when to use save (with exclusions), restore (default new session vs replace=True), list (snapshots for session), and delete (requires snapshot_id). It also notes the alternative session_stop(keep_snapshots=True) for preserving snapshots, giving clear routing between actions and related tools.

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