import { z } from "zod";
export function registerWbExecuteAction(server, client) {
    server.registerTool("wb_execute_action", {
        description: "Execute any Workbench menu action by its menu path. Use comma-separated path segments to identify the action (e.g., 'Tools,Reload Scripts' or 'File,Save').",
        inputSchema: {
            menuPath: z
                .string()
                .describe("Comma-separated menu path (e.g., 'Tools,Reload Scripts', 'File,Save', 'Edit,Undo')"),
        },
    }, async ({ menuPath }) => {
        try {
            const result = await client.call("EMCP_WB_ExecuteAction", {
                menuPath,
            });
            return {
                content: [
                    {
                        type: "text",
                        text: `**Action Executed**\n\nMenu path: ${menuPath}${result.message ? `\n${result.message}` : ""}${result.result ? `\nResult: ${JSON.stringify(result.result)}` : ""}`,
                    },
                ],
            };
        }
        catch (e) {
            const msg = e instanceof Error ? e.message : String(e);
            return {
                content: [
                    {
                        type: "text",
                        text: `Error executing action "${menuPath}": ${msg}`,
                    },
                ],
            };
        }
    });
}
//# sourceMappingURL=wb-execute-action.js.map