diff --git a/mcp/packages/plugin/src/PenpotUtils.ts b/mcp/packages/plugin/src/PenpotUtils.ts index 602ac3327c..d4d3f49967 100644 --- a/mcp/packages/plugin/src/PenpotUtils.ts +++ b/mcp/packages/plugin/src/PenpotUtils.ts @@ -25,7 +25,6 @@ export class PenpotUtils { id: shape.id, name: shape.name, type: shape.type, - children: children, }; // add layout information if present @@ -48,6 +47,23 @@ export class PenpotUtils { }; } + // add component instance information if present + if (shape.isComponentInstance()) { + result.componentInstance = {}; + const component = shape.component(); + if (component) { + result.componentInstance.componentId = component.id; + result.componentInstance.componentName = component.name; + const mainInstance = component.mainInstance(); + if (mainInstance) { + result.componentInstance.mainInstanceId = mainInstance.id; + } + } + } + + // finally, add children (last for more readable nesting order) + result.children = children; + return result; }