import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; import { CplaceApiClient } from '../api.js'; export declare const RICHSTRING_WIDGET_TOOL_DEFINITIONS: { readonly cplace_richstring_extract_widgets: { readonly description: "Extract all embedded widgets from a page's richstring attribute. Reads the page internally and returns structured information about each widget including ID, type, properties, and position. Use this to discover widget IDs before updating or deleting them."; readonly inputSchema: { readonly pageUID: z.ZodString; readonly attributeName: z.ZodOptional; readonly isWikiContent: z.ZodOptional; }; readonly annotations: { readonly title: "Extract Embedded Widgets from RichString"; }; }; readonly cplace_richstring_insert_widget: { readonly description: "Insert a new embedded widget into a page's richstring attribute at a specified position or at the end. Reads the page, inserts the widget via the backend API, and writes the modified content back — all in one call. Returns the inserted widget ID and the full widget inventory. The page content never appears in the LLM context.\n\nIMPORTANT: For low-code widgets that execute cplaceJS scripts (e.g., lowCodeText, lowCodeButton, scriptingHighcharts, scriptingLineChart, dynamicCodeBlockWidget), always test your script first using cplace_execute_script to verify it works correctly before embedding the widget.\n\nMarker-based positioning: pass `insertBefore: \"\"` or `insertAfter: \"\"` to anchor the insert at a textual marker instead of computing a numeric `position`. The marker must match the decoded form — exactly as returned by cplace_richstring_extract_widgets — and must occur exactly once in the content; otherwise the call fails with the same diagnostics shape as cplace_edit_page_content's `old_str`. At most one of `position`, `insertBefore`, `insertAfter` may be set per call.\n\nCOMMON PLATFORM WIDGET TYPES for INSIDE_RICHSTRING embedding:\ncf.platform.singleAttribute, cf.cplace.platform.heading,\ncf.platform.embeddedSearchAsList, cf.cplace.lowCodeWidgets.lowCodeText,\ncf.cplace.lowCodeWidgets.lowCodeButton, cf.cplace.workflow.widget,\ncf.platform.connectedSingleAttribute, cf.platform.numberOfSearchResults,\ncf.platform.connectedNumberOfResults, cf.platform.showNameAttribute,\ncf.platform.attributeHistory\nNote: This is NOT an exhaustive list — plugin apps may provide additional widget types. Call cplace_list_widget_definitions with embeddingContext 'INSIDE_RICHSTRING' for the full dynamic list."; readonly inputSchema: { readonly pageUID: z.ZodString; readonly attributeName: z.ZodOptional; readonly isWikiContent: z.ZodOptional; readonly widgetType: z.ZodString; readonly position: z.ZodOptional; readonly insertBefore: z.ZodOptional; readonly insertAfter: z.ZodOptional; readonly expectedBefore: z.ZodOptional; readonly expectedAfter: z.ZodOptional; readonly properties: z.ZodOptional>; }; readonly annotations: { readonly title: "Insert Embedded Widget into RichString"; }; }; readonly cplace_richstring_update_widget: { readonly description: "Update an existing embedded widget's properties in a page's richstring attribute. Reads the page, updates the widget via the backend API, and writes back — all in one call. Properties are completely replaced (not merged). Returns the updated widget ID and the full widget inventory."; readonly inputSchema: { readonly pageUID: z.ZodString; readonly attributeName: z.ZodOptional; readonly isWikiContent: z.ZodOptional; readonly widgetId: z.ZodString; readonly properties: z.ZodRecord; }; readonly annotations: { readonly title: "Update Embedded Widget in RichString"; }; }; readonly cplace_richstring_delete_widget: { readonly description: "Remove an embedded widget from a page's richstring attribute. Reads the page, deletes the widget via the backend API, and writes back — all in one call. Returns the deleted widget ID and the remaining widget inventory."; readonly inputSchema: { readonly pageUID: z.ZodString; readonly attributeName: z.ZodOptional; readonly isWikiContent: z.ZodOptional; readonly widgetId: z.ZodString; }; readonly annotations: { readonly title: "Delete Embedded Widget from RichString"; }; }; }; export interface RichStringInsertOptions { widgetType: string; position?: number; expectedBefore?: string; expectedAfter?: string; properties?: Record; } export interface RichStringInsertResult { insertedWidgetId: string; insertedAtPosition: number; } export declare function richstringInsertWidget(client: CplaceApiClient, content: string, options: RichStringInsertOptions): Promise<{ result: RichStringInsertResult; modifiedContent: string; }>; export declare function richstringUpdateWidget(client: CplaceApiClient, content: string, widgetId: string, properties: Record): Promise<{ result: { updatedWidgetId: string; }; modifiedContent: string; }>; export declare function richstringDeleteWidget(client: CplaceApiClient, content: string, widgetId: string): Promise<{ result: { deletedWidgetId: string; }; modifiedContent: string; }>; export declare function validatePositioningParams(position: number | undefined, insertBefore: string | undefined, insertAfter: string | undefined): string | null; export declare function registerRichStringWidgetTools(server: McpServer, client: CplaceApiClient): void; //# sourceMappingURL=richstring-widgets.d.ts.map