Skip to main content
Glama

edit

Replace text in files while preserving indentation style and encoding. Automatically converts between tabs and spaces, reads .editorconfig settings, and offers dry-run previews.

Instructions

Replaces old_string with new_string in the specified file. Smart indentation: auto-converts between tabs and spaces to match the file's style. Encoding-aware: preserves original file encoding (UTF-8, EUC-KR, Shift-JIS, UTF-8 BOM, etc.). Reads .editorconfig for indentation settings. Use dry_run=true to preview changes without modifying the file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the file to edit
old_stringYesExact text to find in the file
new_stringYesReplacement text (must differ from old_string)
replace_allNoReplace all occurrences instead of just the first (default false)
dry_runNoPreview changes without modifying the file (default false)
indent_styleNoOverride indentation style. Values: tabs or spaces-N (e.g. spaces-4). Empty = auto-detect (default)
expected_hashNoOptional SHA-256 hash of the file. If provided and mismatched, edit is rejected (optimistic concurrency).

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/knewstimek/agent-tool'

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