Expand description
str_replace: edit a file by replacing an exact string.
This is the recommended editing tool for single-file changes. The LLM
provides an old_string (text to find) and new_string (replacement),
and the tool does a precise search-and-replace with a fuzzy-match
fallback chain that recovers from common LLM output quirks.
Fuzzy-match chain (first success wins):
- Exact match
- Quote normalization (curly to straight quotes)
- Trailing whitespace strip (rstrip each line of old_string)
- Quote normalization + trailing whitespace strip combined
- XML-tag desanitization (model-escaped tags to real tags)
When the match succeeds via quote normalization, curly-quote style is
preserved in new_string so the edit does not silently change typography.