diff --git a/mcp-server/src/PluginTask.ts b/mcp-server/src/PluginTask.ts index 84caa42..f682752 100644 --- a/mcp-server/src/PluginTask.ts +++ b/mcp-server/src/PluginTask.ts @@ -51,34 +51,3 @@ export abstract class PluginTask { }; } } - -/** - * Parameters for the printText task. - */ -export class PluginTaskPrintTextParams { - /** - * The text to be displayed in Penpot. - */ - public readonly text: string; - - constructor(text: string) { - this.text = text; - } -} - -/** - * Task for printing/creating text in Penpot. - * - * This task instructs the plugin to create a text element - * at the viewport center and select it. - */ -export class PluginTaskPrintText extends PluginTask { - /** - * Creates a new print text task. - * - * @param params - The parameters containing the text to print - */ - constructor(params: PluginTaskPrintTextParams) { - super("printText", params); - } -} diff --git a/mcp-server/src/tasks/PrintTextPluginTask.ts b/mcp-server/src/tasks/PrintTextPluginTask.ts new file mode 100644 index 0000000..871a360 --- /dev/null +++ b/mcp-server/src/tasks/PrintTextPluginTask.ts @@ -0,0 +1,32 @@ +import { PluginTask } from "../PluginTask"; + +/** + * Parameters for the printText task. + */ +export class PrintTextPluginTaskParams { + /** + * The text to be displayed in Penpot. + */ + public readonly text: string; + + constructor(text: string) { + this.text = text; + } +} + +/** + * Task for printing/creating text in Penpot. + * + * This task instructs the plugin to create a text element + * at the viewport center and select it. + */ +export class PrintTextPluginTask extends PluginTask { + /** + * Creates a new print text task. + * + * @param params - The parameters containing the text to print + */ + constructor(params: PrintTextPluginTaskParams) { + super("printText", params); + } +} diff --git a/mcp-server/src/tools/PrintTextTool.ts b/mcp-server/src/tools/PrintTextTool.ts index c9b8b53..b8d9926 100644 --- a/mcp-server/src/tools/PrintTextTool.ts +++ b/mcp-server/src/tools/PrintTextTool.ts @@ -1,10 +1,10 @@ import { IsNotEmpty, IsString } from "class-validator"; import { Tool } from "../Tool"; -import { PluginTaskPrintText, PluginTaskPrintTextParams } from "../PluginTask"; import type { ToolResponse } from "../ToolResponse"; import { TextResponse } from "../ToolResponse"; import "reflect-metadata"; import { PenpotMcpServer } from "../PenpotMcpServer"; +import { PrintTextPluginTask, PrintTextPluginTaskParams } from "../tasks/PrintTextPluginTask"; /** * Arguments class for the PrintText tool with validation decorators. @@ -43,8 +43,8 @@ export class PrintTextTool extends Tool { } protected async executeCore(args: PrintTextArgs): Promise { - const taskParams = new PluginTaskPrintTextParams(args.text); - const task = new PluginTaskPrintText(taskParams); + const taskParams = new PrintTextPluginTaskParams(args.text); + const task = new PrintTextPluginTask(taskParams); this.mcpServer.executePluginTask(task); return new TextResponse( `Successfully sent text creation task. Text "${args.text}" should now appear in Penpot.`