Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Update create_file tool output metadata

Abi Raja67717ebd56b2
diff --git a/backend/agent/tools/definitions.py b/backend/agent/tools/definitions.py
index 395207a1..b9a4c17c 100644
--- a/backend/agent/tools/definitions.py
+++ b/backend/agent/tools/definitions.py
@@ -106,7 +106,7 @@ def canonical_tool_definitions(
name="create_file",
description=(
"Create the main HTML file for the app. Use exactly once to write the "
- "full HTML. Returns the updated file content."
+ "full HTML. Returns a success message and file metadata."
),
parameters=_create_schema(),
),
diff --git a/backend/agent/tools/runtime.py b/backend/agent/tools/runtime.py
index 33bacfa5..a846d219 100644
--- a/backend/agent/tools/runtime.py
+++ b/backend/agent/tools/runtime.py
@@ -74,8 +74,11 @@ class AgentToolRuntime:
"preview": summarize_text(self.file_state.content, 320),
}
result = {
- "path": self.file_state.path,
- "content": self.file_state.content,
+ "content": f"Successfully created file at {self.file_state.path}.",
+ "details": {
+ "path": self.file_state.path,
+ "contentLength": len(self.file_state.content),
+ },
}
return ToolExecutionResult(
ok=True,