Skip to main content
Create, read and rewrite HTML page artifacts under a required version check.

create_page

Scope: documents:write (step-up) · Kind: write · Annotations: readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false
Create an HTML page artifact — in a conversation (conversation_id, its card is posted to the room) or in the person’s library with a scope: user (private, the default), pod (needs pod_id), or org. The HTML is stored verbatim; scripts are stripped when the page is viewed, and you are warned when that will happen. Returns — the version write_page requires.

Parameters

Pass either conversation_id or scope (with pod_id when the scope is pod), never both.
string
required
string
required
The page’s HTML, stored verbatim. Must be non-empty.
string
Create inside this conversation; a card is posted to the room.
'user' | 'pod' | 'org'
default:"user"
Where the page lives when no conversation_id is given.
string
Required with scope: "pod".

Returns

string
The artifact id. Use it as page_id for read_page and write_page, and as document_id for comments and export.
string
number
The version write_page must pass as expected_version.
number
string[]
["script_stripped"] when the HTML contains <script> elements, inline event handlers or javascript: URLs. They are stored but removed when the page is viewed, so its interactivity will not run.
Text: Created page "<title>" (page_id: <id>, version <n>). plus Note: its scripts will be stripped when viewed. when applicable.

Permissions and side effects

  • Needs documents:write.
  • The access gate runs inside the create transaction: with conversation_id you must be able to participate in the room; with scope: "pod" you must be a pod member.
  • The caller becomes the owner. With conversation_id a card lands in the room; with a scope nothing is posted.

Errors

Limitations

  • No idempotency key on this tool; a retried create makes a second page.
  • Pages are served with scripts stripped. Style with inline CSS.

Example

Request
Response (structuredContent)

read_page

Scope: documents:read (step-up) · Kind: read-only · Annotations: readOnlyHint: true, destructiveHint: false, openWorldHint: false
Read a page’s stored HTML source and its version — the token write_page’s expected_version is checked against.

Parameters

string
required
The page’s artifact id.

Returns

string
string
string
The stored source, scripts included (they are stripped only at view time).
number
Pass as expected_version to write_page.
Text: # <title> (version <n>) followed by the HTML.

Permissions and side effects

  • Needs documents:read and any role on the page. The access check and the source read happen in one transaction.
  • Reads only. Recorded in the agent activity history.

Errors

Example

Request
Response (structuredContent)

write_page

Scope: documents:write (step-up) · Kind: write, destructive · Annotations: readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false
Replace a page’s HTML wholesale. expected_version is REQUIRED — the version read_page (or create_page) returned. If the page moved since your read, the write refuses with the current version and a line-level diff of what changed, so you can merge and retry; there is no force flag, by design. Scripts are stored but stripped at view.

Parameters

string
required
string
required
The complete new HTML. Must be non-empty.
number
required
The version read_page or create_page returned. Must be a non-negative integer.

Returns

string
number
number
string[]
["script_stripped"] when the HTML carries scripts.
Text: Wrote the page; it is now at version <n> (<bytes> bytes).

Permissions and side effects

  • Needs documents:write and the editor or owner role. The role is re-checked inside the write transaction.
  • Replaces the whole page. The previous source is kept as a checkpoint.
  • Attributed to you via the host.

Errors

There is deliberately no way to overwrite a newer version without reading it first.

Example

Request
Response (structuredContent)
Conflict response (structuredContent)