Skip to main content
Glama

edit_file

Replace a specific, unique string in a file to modify its content while maintaining file structure and updating its cached summary.

Instructions

Edit a file by replacing a specific string. The file becomes (or remains) the active file.

The old_string must:

  • Match exactly, including whitespace and indentation

  • Appear exactly once in the file (for safety)

After editing, the file's cached summary is updated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the file to edit
old_stringYesThe exact string to replace (must be unique in the file)
new_stringYesThe string to replace it with

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/UBTCodeNinja/mcp-file-compaction'

If you have feedback or need assistance with the MCP directory API, please join our Discord server