Skip to content

Commit 82e9e0f

Browse files
Change Tool Output for Filesystem Edit MCP (#587)
Also removes the summary from being computed
1 parent 67bd849 commit 82e9e0f

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

  • mcp-servers/mcp-server-filesystem-edit/mcp_server_filesystem_edit

mcp-servers/mcp-server-filesystem-edit/mcp_server_filesystem_edit/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ async def edit_file(ctx: Context, path: str, task: str) -> str:
376376
)
377377
editor = CommonEdit()
378378
output = await editor.run(request)
379-
tool_output: str = output.change_summary + "\n" + output.output_message
379+
tool_output: str = f'This is the new content of the file:\n<file filename="{validated_path.name}">\n{output.new_content or output.output_message}\n</file>\n'
380+
tool_output += "The user can see the new content in their editor of choice, so you should only briefly summarize the changes that were made."
380381
await write_file(ctx, validated_path, output.new_content)
381382
# If this is a tex file, auto compile it to PDF
382383
if file_type == "latex" and settings.pdflatex_enabled:
@@ -399,7 +400,8 @@ async def edit_file(ctx: Context, path: str, task: str) -> str:
399400
)
400401
editor = CommonEdit()
401402
output = await editor.run(request)
402-
tool_output: str = output.change_summary + "\n" + output.output_message
403+
tool_output: str = f'This is the new content of the file:\n<file filename="{validated_path.name}">\n{output.new_content or output.output_message}\n</file>\n'
404+
tool_output += "The user can see the new content in their editor of choice, so you should only briefly summarize the changes that were made."
403405
write_markdown(document, output.new_content)
404406
case ".pptx":
405407
_, document = open_document_in_office(validated_path, OfficeAppType.POWERPOINT)

mcp-servers/mcp-server-filesystem-edit/mcp_server_filesystem_edit/tools/edit.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,8 @@ async def run(self, request: FileOpRequest) -> EditOutput:
260260
tool_calls = convert_response.choices[0].message.tool_calls or []
261261
updated_doc_markdown, output_message = await self.execute_tool_calls(request, convert_response)
262262

263-
change_summary = await self.run_change_summary(
264-
before_doc=request.file_content,
265-
after_doc=updated_doc_markdown,
266-
edit_request=request,
267-
)
268263
output = EditOutput(
269-
change_summary=change_summary,
264+
change_summary="",
270265
output_message=output_message,
271266
new_content=updated_doc_markdown,
272267
reasoning=reasoning,

0 commit comments

Comments
 (0)