Skip to navigation

Replace a piece of a text file

View as Markdown

Replace one piece of text in a text file, without sending the full content. Give oldText exactly as it is in the file (read it with read_file). oldText must occur one time. Basement saves a new version. For a file that is not text, use write_file. Requires write access.

Authentication

AuthorizationBearer

A Basement key (bsmt_...), from Agents, Connect in the app.

Request

This endpoint expects an object.
fileIdstringRequired

The file ID from list_files, list_skills or search

oldTextstringRequired
The text to replace, exactly as it is in the file
newTextstringRequired
The new text. An empty string deletes oldText

Response

The tool's answer.
versionCountinteger

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
429
Too Many Requests Error
500
Internal Server Error