docs(coderd/x/chatd): improve edit_files tool description (#24627)

Document the fuzzy matching behavior, error-on-ambiguity semantics,
and atomic batch validation that were missing from the tool
description. These are the three behaviors most likely to surprise
callers who assume naive exact-match search/replace.
This commit is contained in:
Mathias Fredriksson
2026-04-29 11:30:27 +00:00
committed by GitHub
parent 782b7166a4
commit 5ceca94e0c
+6 -2
View File
@@ -22,8 +22,12 @@ type EditFilesArgs struct {
func EditFiles(options EditFilesOptions) fantasy.AgentTool {
return fantasy.NewAgentTool(
"edit_files",
"Perform search-and-replace edits on one or more files in the workspace."+
" Each file can have multiple edits applied atomically.",
"Perform search-and-replace edits on one or more files. Matching"+
" is fuzzy (tolerates whitespace and indentation differences) and"+
" preserves the file's existing indentation and line endings."+
" Errors if search matches zero locations, or more than one unless"+
" replace_all is set. All edits in a batch are validated before any"+
" file is written.",
func(ctx context.Context, args EditFilesArgs, _ fantasy.ToolCall) (fantasy.ToolResponse, error) {
var planPath string
if options.IsPlanTurn && len(args.Files) > 0 {