From ef060c4da6242f4fd8fdfaf208f825be3bcc1abb Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Sun, 19 Oct 2025 23:03:22 +0200 Subject: [PATCH] Improve description of ExecuteCodeTool --- mcp-server/src/tools/ExecuteCodeTool.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mcp-server/src/tools/ExecuteCodeTool.ts b/mcp-server/src/tools/ExecuteCodeTool.ts index c78f357..297f589 100644 --- a/mcp-server/src/tools/ExecuteCodeTool.ts +++ b/mcp-server/src/tools/ExecuteCodeTool.ts @@ -46,13 +46,17 @@ export class ExecuteCodeTool extends Tool { "Executes JavaScript code in the Penpot plugin context.\n" + "IMPORTANT: Before using this tool, make sure you have read the 'Penpot High-Level Overview' and know " + "which Penpot API functionality is necessary and how to use it.\n" + - "You have access two main objects: `penpot` (the Penpot API, of type `Penpot`) and `storage` (an object in which arbitrary " + - "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.\n" + - "Any output that you generate via the `console` object will be returned to you; so you may use this" + - "to track what your code is doing, but you should only do so only if there is an ACTUAL NEED for this! " + + "You have access two main objects: `penpot` (the Penpot API, of type `Penpot`), `penpotUtils`, " + + "and `storage`.\n" + + "`storage` is an object in which arbitrary 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; " + + "you can also store functions and thus build up a library).\n" + + "Think of the code being executed as the body of a function: " + + "The tool call returns whatever you return in the applicable `return` statement, if any.\n" + + "If an exception occurs, the exception's message will be returned to you.\n" + + "Any output that you generate via the `console` object will be returned to you separately; so you may use it" + + "to track what your code is doing, but you should *only* do so only if there is an ACTUAL NEED for this! " + "VERY IMPORTANT: Don't use logging prematurely! NEVER log the data you are returning, as you will otherwise receive it twice!\n" + "VERY IMPORTANT: 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) and that applies logging."