diff --git a/mcp-server/data/prompts.yml b/mcp-server/data/prompts.yml index 643aa16..06ce675 100644 --- a/mcp-server/data/prompts.yml +++ b/mcp-server/data/prompts.yml @@ -9,6 +9,7 @@ initial_instructions: | One of the key tools is the execute_code tool, which allows you to run JavaScript code using the Penpot Plugin API directly in the connected project. + When writing code, a key object is the `penpot` object which provides key functionality: * `penpot.selection` provides the list of elements the user has selected in the Penpot UI. If it is unclear which elements to work on, you can ask the user to select them for you. @@ -23,4 +24,7 @@ initial_instructions: | type?: "html" | "svg"; }): string; + For example, to generate CSS for the selected elements, you can execute this: + return penpot.generateStyle(penpot.selection, { type: "css", withChildren: true }); + You have hereby read the 'Penpot High-Level Overview' and need not use a tool to read it again. diff --git a/mcp-server/src/tools/ExecuteCodeTool.ts b/mcp-server/src/tools/ExecuteCodeTool.ts index 4e34ec5..34e6d59 100644 --- a/mcp-server/src/tools/ExecuteCodeTool.ts +++ b/mcp-server/src/tools/ExecuteCodeTool.ts @@ -45,7 +45,10 @@ export class ExecuteCodeTool extends Tool { "data can be stored, simply by adding a new attribute; stored attributes can be referenced in future calls " + "to this tool, so any intermediate results that could come in handy later should be stored in `storage` " + "instead of just a fleeting variable).\n" + - "The tool call returns the value of the concluding return statement, if any." + "The tool call returns the value of the concluding return statement, if any.\n" + + "Note that using console.log() in your code makes no sense as you will not see the output.\n" + + "In general, try a simple approach first, and only if it fails, try more complex code that involves " + + "handling different cases (in particular error cases)." ); }