import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; import { CplaceApiClient } from '../api.js'; export declare const PAGE_ACTION_SIMULATION_TOOL_DEFINITIONS: { readonly cplace_simulate_page_action: { readonly description: "Execute a page-action script under the production page-action engine context for pre-embed verification.\n\nThis tool runs the real two-phase page-action lifecycle from the cplace platform\n(`ExecutePageActionHandler`). The bindings, allowed type classes, and posture come\nfrom the platform source row — see `script-context-cards/page-action.md` and\n`best-practices/low-code/script-contexts.md`.\n\n**Script shape**: `script` must evaluate to an action object that exposes at least a\n`call` method (optionally a `checkAccess` method), exactly like a saved page action:\n```js\nreturn {\n checkAccess: function() { return true; }, // optional; false denies and skips call()\n call: function() {\n // write-enabled — persisting actions commit here\n cplace.actions('').createPage({ name: '...', space: '...', customType: '...' });\n return 'ok';\n }\n};\n```\n\n**Two-phase lifecycle**:\n1. **Load (module level)** runs under `ServerMode.prohibitWriteAccess`. The object is\n evaluated here. A write or persisting action at module level **fails** — move it into\n `call()`. A missing `call` member is rejected.\n2. **checkAccess + call**. `checkAccess()` is honored: returning `false` reports access\n denial and `call()` is **not** run. `call()` then runs **write-enabled** — persisting\n actions (`createPage`, `deletePage`, …) **commit**. This requires low-code edit\n permission (`mayEditLowCode`); without it the call is denied.\n\nThe tool returns `call()`'s **raw value**. It does **not** reproduce the framework's\nreturn-object interpretation (`success` / `message` / `target` → URL / `job` → modal).\n**Timeout**: 30 seconds maximum execution time.\n\n**Injected bindings** (in addition to the baseline cplace API):\n- `page` — WrappedPage the action was invoked on\n- `embeddingPage` — WrappedPage hosting the action (aliased to `page` at this row in production)\n- `messages` — CplaceJSTypeMessageProvider for the page's type (when one exists)\n\n**Allowed type classes**: `Search`, `Filters` (lowcode wrapper classes).\n**`cplace.actions(...)`**: enabled. Use it for any state-changing side effect (inside `call()`).\n\n**Writes are real**: a `call()` that persists commits to the dev instance. There is no\ndry-run/rollback mode.\n\n**Return Value Restrictions**: Same as cplace_execute_script (primitives and nested arrays/objects up to 3 levels; use JSON.stringify for deeper data).\n\n**When to use**: Before saving a page-action script, to verify the action object's\n`checkAccess`/`call` control flow against `page`, `embeddingPage`, and any\n`cplace.actions()` call. For other contexts (widget, change listener, validator, job,\nwizard, button widget) use the matching `cplace_simulate_*` tool — never\n`cplace_execute_script_write` for context-specific scripts."; readonly inputSchema: { readonly script: z.ZodString; readonly pageUID: z.ZodString; readonly embeddingPageUID: z.ZodString; }; readonly annotations: { readonly title: "Simulate Page-Action Script"; }; }; }; export declare function registerPageActionSimulationTools(server: McpServer, client: CplaceApiClient): void; //# sourceMappingURL=page-action-simulation.d.ts.map