diff --git a/CHANGES.md b/CHANGES.md index 58e3043923..33bf62347d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -85,6 +85,7 @@ ## 2.13.0 ### :heart: Community contributions (Thank you!) +- Add 'page' special shapeId to MCP export_shape tool for full-page snapshots [Github #8689](https://github.com/penpot/penpot/issues/8689) - Fix mask issues with component swap (by @dfelinto) [Github #7675](https://github.com/penpot/penpot/issues/7675) diff --git a/mcp/packages/server/src/tools/ExportShapeTool.ts b/mcp/packages/server/src/tools/ExportShapeTool.ts index d032b0b770..7b8ceed4a6 100644 --- a/mcp/packages/server/src/tools/ExportShapeTool.ts +++ b/mcp/packages/server/src/tools/ExportShapeTool.ts @@ -16,8 +16,8 @@ export class ExportShapeArgs { .string() .min(1, "shapeId cannot be empty") .describe( - "Identifier of the shape to export. Use the special identifier 'selection' to " + - "export the first shape currently selected by the user." + "Identifier of the shape to export. " + + "Special identifiers you can use: 'selection' (first shape currently selected by the user), 'page' (entire current page)" ), format: z.enum(["svg", "png"]).default("png").describe("The output format, either 'png' (default) or 'svg'."), mode: z @@ -71,7 +71,7 @@ export class ExportShapeTool extends Tool { public getToolDescription(): string { let description = "Exports a shape (or a shape's image fill) from the Penpot design to a PNG or SVG image, " + - "such that you can get an impression of what it looks like. "; + "such that you can get an impression of what it looks like."; if (this.mcpServer.isFileSystemAccessEnabled()) { description += "\nAlternatively, you can save it to a file."; } @@ -88,6 +88,8 @@ export class ExportShapeTool extends Tool { let shapeCode: string; if (args.shapeId === "selection") { shapeCode = `penpot.selection[0]`; + } else if (args.shapeId === "page") { + shapeCode = `penpot.root`; } else { shapeCode = `penpotUtils.findShapeById("${args.shapeId}")`; }