INNER CODE UNIT · Python
list_snapshots
deeplethe/forkd · sdk/mcp/sandstorm_mcp/server.py:127
def list_snapshots() -> list[dict[str, Any]]:
"""List snapshot tags, which spawn_sandboxes can fork from.
A tag is a checkpoint made by branch_sandbox, so a new deployment has
none. Returns Snapshot objects: tag, node_id, template, from_sandbox,
dir, size_bytes, created_at.
"""
with _client() as c:
r = c.get("/v1/snapshots")
r.raise_for_status()
return r.json()
@mcp.tool()
def delete_snapshot(tag: str) -> dict[str, Any]:
"""Delete a snapshot tag. Refused with 409 while sandboxes are forked from it."""
with _client() as c:
r = c.delete(f"/v1/snapshots/{quote(tag, safe='')}")