Documentation
Examples & Workflows
Examples of how to use an AI agent with PaperCast.
This page demonstrates practical workflows for using AI agents with the PaperCast MCP Server.
Prompting for an invoice
Because the AI agent can read your local playground state, you can give it high-level, declarative commands.
Example Prompt
"Connect to my active PaperCast session. Build an invoice template. Start by
creating a header with our company logo on the left and the word 'INVOICE' in
large, bold text on the right. Then, add a data table bound to
invoice.lineItems."
Execution flow
- Connection: The agent uses
get_active_sessionsandselect_active_sessionto establish a link to your browser tab. - Layout scaffolding: It calls
insert_layout_elementto create arowcontaining twocolumnchildren. - Widget injection: It uses
add_text_widgetto insert the title and an image widget for the logo. - Data binding: It calls
add_table_widgetand configures thebindPathtoinvoice.lineItems.
As the agent performs these tool calls, the changes instantly appear in your browser.
Debugging overflowing layouts
If a layout fails to wrap or a table overflows off the page, instruct the agent to fix it visually.
Example Prompt
"The line items table overflows off the right edge of the page. Inspect the schema and fix the column widths."
Execution flow
- State retrieval: The agent uses
get_document_stateto pull down your JSON schema. - Analysis: It identifies the
flexorwidthproperties causing the overflow. - Correction: It uses
update_element_propertiesto apply the correct constraints.