From f22b567df09a70a262acf9b3f399c60f7e4d97d3 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sun, 28 Jun 2026 11:50:06 +0000 Subject: [PATCH] fix create_representation: enrich files with id+path required by AYON --- src/ayon_mcp/client.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ayon_mcp/client.py b/src/ayon_mcp/client.py index 6ca2ffd..a48e6b1 100644 --- a/src/ayon_mcp/client.py +++ b/src/ayon_mcp/client.py @@ -239,13 +239,25 @@ class AyonClient: name: str, files: list[dict], ) -> dict: - """files: [{"name": "BaseColor.png", "size": 12345}, ...]""" + """files: [{"name": "BaseColor.png", "size": 12345}, ...] + + Files are enriched with required 'id' (UUID) and 'path' fields. + """ + import uuid + enriched = [] + for f in files: + enriched.append({ + "id": uuid.uuid4().hex, + "name": f.get("name", f.get("path", "file")), + "path": f.get("path", f"/tmp/{f.get('name', 'file')}"), + "size": f.get("size", 0), + }) r = self._client.post( f"/api/projects/{project}/representations", json={ "name": name, "versionId": version_id, - "files": files, + "files": enriched, }, ) r.raise_for_status()