# write_storage

Canonical URL: https://developers.iagenify.com/sdk/agent/tools/write-storage/
Language: en

`write_storage({ storage?, action, … })`

Change a connected database or bucket. There is no undo — which is why it is asked even in auto, and why two guards fire before the prompt.

Status: category: storage · asked even in auto · no undo

## The actions {#actions}

| Action | On |
| --- | --- |
| `insert` · `update` · `delete` | a document database |
| `create_collection` · `drop_collection` | a document database |
| `sql` | a relational database — one statement |
| `put` · `remove` | a bucket |

## Two guards before the prompt {#guards}

| Refused | Unless |
| --- | --- |
| An empty MongoDB filter, or SQL without `WHERE` | `all: true` is passed |
| `DROP` and `drop_collection` | The mode is full access |

> **A guard that fires costs no prompt**
>
> The call fails with an explanation the model can act on, and the user is never asked about something that was going to be refused anyway.

## It is told to say what it will change {#say-first}

The tool's own description begins with it: there is no undo, so say what you will change before calling. That is the behaviour a permission prompt depends on — the user should already know what they are approving.

## « always » is per storage {#always}

Approving one storage for the session leaves the others asked. Nothing is written to disk.

## put takes a workspace file {#upload}

```javascript
write_storage({ action: "put", key: "reports/q3.pdf", path: "Reports/q3.pdf" })
```

`content` for text, `path` for a file already in the workspace — which is how a generated PDF reaches a bucket without passing through the conversation.

- [query_storage](/sdk/agent/tools/query-storage): Reading first.
- [storage](/sdk/agent/permissions/categories/storage): Why auto still asks.
- [Agent tools](/sdk/agent/tools): The 35, by family.

```python
# The call the model makes:
write_storage = {"action": "put", "key": "reports/q3.pdf", "path": "Reports/q3.pdf"}
```
