Skip to content

Change Tool Output for Filesystem Edit MCP #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ async def edit_file(ctx: Context, path: str, task: str) -> str:
)
editor = CommonEdit()
output = await editor.run(request)
tool_output: str = output.change_summary + "\n" + output.output_message
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'
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."
await write_file(ctx, validated_path, output.new_content)
# If this is a tex file, auto compile it to PDF
if file_type == "latex" and settings.pdflatex_enabled:
Expand All @@ -399,7 +400,8 @@ async def edit_file(ctx: Context, path: str, task: str) -> str:
)
editor = CommonEdit()
output = await editor.run(request)
tool_output: str = output.change_summary + "\n" + output.output_message
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'
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."
write_markdown(document, output.new_content)
case ".pptx":
_, document = open_document_in_office(validated_path, OfficeAppType.POWERPOINT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,8 @@ async def run(self, request: FileOpRequest) -> EditOutput:
tool_calls = convert_response.choices[0].message.tool_calls or []
updated_doc_markdown, output_message = await self.execute_tool_calls(request, convert_response)

change_summary = await self.run_change_summary(
before_doc=request.file_content,
after_doc=updated_doc_markdown,
edit_request=request,
)
output = EditOutput(
change_summary=change_summary,
change_summary="",
output_message=output_message,
new_content=updated_doc_markdown,
reasoning=reasoning,
Expand Down