Skip to content

Commit dbb57df

Browse files
committed
Simplify text editor edit reply format
- Drop the parenthetical stats from the assistant summary per review feedback - Use cleaner 'Successfully replaced text in {path}.' format (inspired by pi) - Keep line number info in user-facing output only - Align Editor API success message to same format
1 parent 1880cf3 commit dbb57df

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

crates/goose-mcp/src/developer/text_editor.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,9 @@ pub async fn text_editor_replace(
799799

800800
// Simple success message for Editor API
801801
return Ok(vec![
802-
Content::text(format!("Successfully edited {}", path.display()))
802+
Content::text(format!("Successfully replaced text in {}.", path.display()))
803803
.with_audience(vec![Role::Assistant]),
804-
Content::text(format!("File {} has been edited", path.display()))
804+
Content::text(format!("Successfully replaced text in {}.", path.display()))
805805
.with_audience(vec![Role::User])
806806
.with_priority(0.2),
807807
]);
@@ -848,8 +848,6 @@ pub async fn text_editor_replace(
848848
)
849849
})?;
850850

851-
// Count lines changed for a concise summary
852-
let old_line_count = old_str.lines().count();
853851
let new_line_count = new_str.lines().count();
854852

855853
// Count newlines before the replacement to find the line number
@@ -861,13 +859,7 @@ pub async fn text_editor_replace(
861859
.count()
862860
+ 1; // 1-indexed
863861

864-
let summary = format!(
865-
"Successfully edited {} (replaced {} lines with {} lines at line {})",
866-
path.display(),
867-
old_line_count,
868-
new_line_count,
869-
replacement_line
870-
);
862+
let summary = format!("Successfully replaced text in {}.", path.display());
871863

872864
// Try to detect the language from the file extension
873865
let language = lang::get_language_identifier(path);
@@ -886,12 +878,13 @@ pub async fn text_editor_replace(
886878
.join("\n");
887879

888880
let user_output = formatdoc! {r#"
889-
{summary}
881+
Successfully replaced text in {path} at line {line}.
890882
```{language}
891883
{snippet}
892884
```
893885
"#,
894-
summary=summary,
886+
path=path.display(),
887+
line=replacement_line,
895888
language=language,
896889
snippet=snippet
897890
};

0 commit comments

Comments
 (0)