await storage.run({ action: "dropCollection", collection: "temp_import" });
// { ok: true, dropped: "temp_import", documents: 48211 }storage.run(action="dropCollection", collection="temp_import")
# {"ok": True, "dropped": "temp_import", "documents": 48211}It comes back after the fact, not before. Read the count yourself first if the number would have changed your mind — that call is free.
const { count } = await storage.run({ action: "count", collection });
if (count > 0) throw new Error(`${collection} still holds ${count} documents`);
await storage.run({ action: "dropCollection", collection });count = storage.run(action="count", collection=collection)["count"]
if count > 0:
raise RuntimeError(f"{collection} still holds {count} documents")
storage.run(action="dropCollection", collection=collection)A collection that is not there is refused
Rather than answering « done » for something that never existed — which would hide a typo in a name, at the exact moment a typo matters most.
const existing = await storage.run({ action: "collections" });
if (!existing.some((c) => c.name === collection)) {
// Nothing to drop. A misspelling here would otherwise look like success.
}existing = storage.run(action="collections")
if not any(c["name"] == collection for c in existing):
pass # Nothing to drop. A misspelling here would otherwise look like success.It works even when the storage is full
Like delete, dropping is allowed past the quota: it is how you make room, so refusing it would leave a storage that cannot be emptied.
What an agent may do with it
In the planning mode it is refused outright. Everywhere else it is asked for. If an agent of yours should never drop anything, say so in its instructions and answer the prompt — the mode alone is a blunt instrument.