Control which edit tool Grok uses

configuration

// what it does

With MORPH_API_KEY set, Grok gains the edit_file tool (Morph) alongside the built-in str_replace_editor and chooses between them automatically: edit_file for complex, multi-line refactors and str_replace_editor for simple single-line replacements. Without the Morph key, only str_replace_editor is available.

// shell

$ grok -p "refactor this function to use async/await and add error handling"

// gotcha

You do not invoke these tools directly — Grok picks one per edit. If large refactors feel slow or lossy, confirm MORPH_API_KEY is actually set, since it silently falls back to str_replace_editor when Morph is unavailable.

// resources