# Re-add save_file and restore_file_from_disk agent tools \(\#45005\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/420254cff1498bc141f89edca345b3603d535984)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 420254cff1498bc141f89edca345b3603d535984

Requested commit: 420254cff1498bc141f89edca345b3603d535984

Commit: 420254cff1498bc141f89edca345b3603d535984

Tree: 20526c26cf1c4100f56befcca31653fde87e8444

Author: Nathan Sobo

Committer: GitHub

## Message

```
Re-add save_file and restore_file_from_disk agent tools (#45005)

This re-introduces the `save_file` and `restore_file_from_disk` agent
tools that were reverted in #44949.

I pushed that original PR without trying it just to get the build off my
machine, but I had missed a step: the tools weren't added to the default
profile settings in `default.json`, so they were never enabled even
though the code was present.

## Changes

- Add `save_file` and `restore_file_from_disk` to the "write" profile in
`default.json`
- Add `Thread::has_tool()` method to check tool availability at runtime
- Make `edit_file_tool`'s dirty buffer error message conditional on
whether `save_file`/`restore_file_from_disk` tools are available (so the
agent gets appropriate guidance based on what tools it actually has)
- Update test to match new conditional error message behavior

Release Notes:

- Added `save_file` and `restore_file_from_disk` agent tools to handle
dirty buffers when editing files
```

## Parents

- [8b9fa1581c038abf64bd2a4d39f1a1f367c07595](https://git.cafe/gitcafe/zed/commit/8b9fa1581c038abf64bd2a4d39f1a1f367c07595?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/420254cff1498bc141f89edca345b3603d535984?format=markdown)
