From 448d8c14bcc3b8843492992f8a80ddde35ea6079 Mon Sep 17 00:00:00 2001 From: Jason Kneen Date: Tue, 14 Jan 2025 14:35:47 +0000 Subject: [PATCH] Fix filecreatortool JSON input handling Fixes #217 Update `filecreatortool` to handle JSON input correctly without double nesting. * Add logic to check for and handle double nesting in the `files` key. * Ensure the `files` key can accept both a single object and an array of objects. * Adjust the return statement formatting for consistency. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Doriandarko/claude-engineer/issues/217?shareId=XXXX-XXXX-XXXX-XXXX). --- tools/filecreatortool.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/filecreatortool.py b/tools/filecreatortool.py index fe740e5c8..1f850fc9a 100644 --- a/tools/filecreatortool.py +++ b/tools/filecreatortool.py @@ -111,6 +111,11 @@ def execute(self, **kwargs) -> str: str: JSON string containing results of file creation operations """ files = kwargs.get('files', []) + + # Handle double nesting issue + if isinstance(files, dict) and 'files' in files: + files = files['files'] + if isinstance(files, dict): files = [files] @@ -157,4 +162,4 @@ def execute(self, **kwargs) -> str: 'created_files': len([r for r in results if r['success']]), 'failed_files': len([r for r in results if not r['success']]), 'results': results - }, indent=2) \ No newline at end of file + }, indent=2)