PowerScroll

v0.67.1
io.github.CynaCons/powerscroll Checked 12 hours ago Published 3 months ago

Read and edit a live local-first PowerScroll visual notebook.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_pages

List every section and page in the connected notebook, with the number of text blocks on each and which page is currently open. Call this first to discover page ids.

read_page

Read a page. DEFAULT CHANGED in v0.54: blocks[] is free-standing markdown only — diagram labels (text nodes with a groupId) no longer leak in as fake content, and diagrams are collapsed to diagrams[] {id, title, format, memberCount, bounds} with NO members and NO source. Images are a compact images[] index {id, alt, x, y, w, h, naturalWidth, naturalHeight, bytes, mini, scrollId} — never the base64 payload. Discovery flow: read_page → diagrams[].id → read_diagram / delete_diagram / fit_diagram; read_page → images[].id → read_image (writes a local file you open with vision). include…

ParameterTypeDescription
cursorstringBlock id to start AFTER. Pass the last blockId (or nextCursor) from the previous read_page. Stable across appends.
includearrayWhich collections to return. Default ["blocks","diagrams","images"]. "images" alone is the images-only fetch; "diagrams" alone is diagrams-only.
include_diagram_sourcebooleanIf true, each diagrams[] entry includes its source text. Default false.
limitintegerMax blocks to return (after filters). Combine with cursor to page.
pageIdstringPage to read. Defaults to the page currently open in the app.
scrollIdstringRestrict blocks, diagrams and images to this scroll band.

read_diagram

Read one diagram: id, title, format, source, bounds, memberCount, and a page of members [{id, type, x, y, w, h, label?}]. member_limit + member_cursor page members (cursor = last member id; same style as read_page). Default member_limit is derived from the 20000-character budget so a typical page sits well under it. If the serialized response still exceeds the budget, members trim at an entry boundary (truncated {at, notice}). Source counts toward the budget; if source alone blows it, source is cut (sourceTruncated {fullLength, notice}) and the notice names the full length and suggests exporti…

ParameterTypeDescription
diagramId *stringDiagram frame id from read_page diagrams[].id or create_diagram.
member_cursorstringMember id to start AFTER. Pass the last member id (or nextCursor) from the previous read_diagram.
member_limitintegerMax members to return. Default is derived from the 20000-character budget.

read_image

Export one image by node id so you can look at it. Discovers ids from read_page images[].id. The notebook returns the embedded bytes over the bridge; this server decodes them and writes a local file. Optional out_path (absolute) names the destination — parent dirs are created; an existing file is overwritten. When omitted, the file lands in os.tmpdir()/powerscroll-images/<id>.<ext>. The response is {path, format, bytes, naturalWidth, naturalHeight, alt} — NEVER the base64 payload. Unknown id is NOT_FOUND. A non-image id is UNSUPPORTED naming the type. Then open the file with your vision to…

ParameterTypeDescription
id *stringImage node id from read_page images[].id.
out_pathstringAbsolute file path to write. Parent directory is created if missing. Omit to write os.tmpdir()/powerscroll-images/<id>.<ext>.

get_block

Re-fetch a single markdown block by id (BlockSummary plus page location). Use this after read_page hits the size cap. A block larger than the 20000-character budget is returned in slices: the response carries markdownTruncated {fullLength, notice} and nextOffset — pass nextOffset back as offset to continue. Any block, any size, is fully readable in bounded calls. Unknown or non-block ids are NOT_FOUND.

ParameterTypeDescription
blockId *stringBlock id from read_page.
offsetnumberCharacter offset into the block markdown (from a previous response's nextOffset). Omit to start at 0.

fit_diagram

Refit an existing diagram to the scroll band its frame sits in. Unlike placement-time fit (shrink-only), this scales BOTH directions: up to fill band-width minus padding when the diagram is under-width, down with the same 0.45 floor when over. Works on member diagrams (members rescale) and on renderMode 'snapshot' diagrams (the frame rescales; the image follows). Out-of-band frames are refused (PRECONDITION, naming the diagram). Discover ids from read_page diagrams[]. One undo in the app.

ParameterTypeDescription
diagramId *stringDiagram frame id from read_page diagrams[].id.

create_section

Create a new section (a tab in the notebook sidebar). Sections contain pages. A first empty page is created along with it.

ParameterTypeDescription
title *stringSection title.

create_page

Create a new page and open it. By default also writes the title onto the canvas as an H1 block so the page reads as a titled note.

ParameterTypeDescription
title *stringPage title.
columnintegerA4 page guide to place the heading in: 0 is the leftmost (default).
sectionIdstringSection to create the page in. Defaults to the active section.
withHeadingbooleanWrite an "# Title" block onto the canvas too. Default true.

append_block

Append a markdown block to the bottom of a page. This is the main way to write content. The markdown is rendered live in the app: use "- " for bullets, "1. " for numbered lists, "- [ ] " for checkboxes (which the user can then click to tick), "#"/"##" for headings, **bold**, `code`, tables, and $math$. Prefer one block per logical chunk (one list, one paragraph) rather than one block per line.

ParameterTypeDescription
markdown *stringMarkdown content for the block.
columnintegerRaw A4 page-guide index: 0 is the leftmost, 1 the guide to its right. Legacy fallback — prefer scrollId, which keeps pointing at the same scroll after scrolls are reordered. Ignored when scrollId is…
pageIdstringPage to append to. Defaults to the page currently open.
scrollIdstringScroll (named column) to write into. THIS IS THE PREFERRED WAY to choose where a block lands — call list_scrolls first and pass an id from it. Each scroll stacks independently, so two workstreams ca…

insert_block

Insert a markdown block into a scroll at a chosen position, shifting every occupant below it (text, diagram frames, images, shapes, ungrouped ink) down by the new block's height + 12px. Frame members ride the frame. Prefer after (a block or diagram-frame id): ids survive reordering, indices do not. Exactly one of after or index. index 0 is the top of the column (ceiling-clamped when a titled scroll arms the page ceiling). index counts packed occupants of the scroll, not read_page blocks[] — prefer after. Returns the new block plus displacedCount.

ParameterTypeDescription
markdown *stringMarkdown content for the block.
scrollId *stringScroll to insert into (from list_scrolls). Required.
afterstringInsert after this occupant id (a markdown block or diagram frame in the same scroll). Preferred. Do not pass index at the same time.
indexinteger0-based index in the scroll's packed-occupant reading order (text and diagrams). 0 = column top. Do not pass after at the same time. Prefer after: index is not read_page blocks[] order.

insert_image

Insert an image into a scroll at a chosen position, shifting every occupant below it (text, diagram frames, images, shapes, ungrouped ink) down by the image's display height + 12px. Frame members ride the frame. Source is exactly one of data (a data:image/...;base64, URI) or path (a local png/jpg/jpeg/gif/webp file this server reads and encodes — the app never sees paths). Both or neither is an error. Placement matches insert_block: prefer after (an occupant id); exactly one of after or index. index 0 is the column top (ceiling-clamped when a titled scroll arms the page ceiling). Optional al…

ParameterTypeDescription
scrollId *stringScroll to insert into (from list_scrolls). Required.
afterstringInsert after this occupant id (a markdown block or diagram frame in the same scroll). Preferred. Do not pass index at the same time.
altstringAlt text. Defaults to "image".
datastringBase64 data URI (data:image/...;base64,...). Exactly one of data or path.
indexinteger0-based index in the scroll's packed-occupant reading order. 0 = column top. Do not pass after at the same time. Prefer after.
minibooleanIf true, land as a Mini thumbnail (default width 160). Displacement uses the mini height.
pathstringLocal file path (png, jpg, jpeg, gif, or webp). This server reads and encodes it; the app never sees the path. Exactly one of data or path.

move_block

Move a markdown block or diagram frame inside a scroll or across scrolls on the same page. Occupants below the source close up; occupants at the target open a gap. Diagram members ride the frame. ONE undo. Prefer after (a block or diagram-frame id) over index: ids survive reordering. scrollId is optional and defaults to the block's current scroll; when given it must be on the same page. Exactly one of after or index. Diagram members, shapes and images as the move target are refused by name. Returns the block plus displacedCount.

ParameterTypeDescription
blockId *stringMarkdown block or diagram frame to move (from read_page / diagrams[].id).
afterstringPlace after this block id in the destination scroll. Preferred. Do not pass index at the same time.
indexinteger0-based index in the destination scroll's remaining content blocks. Do not pass after at the same time.
scrollIdstringDestination scroll. Omit to stay in the current scroll. Must be on the same page.

create_diagram_plantuml

Draw a UML diagram on the page from PLANTUML source. (For Mermaid source, use create_diagram_mermaid instead - this tool refuses it rather than half-drawing it.) Two PlantUML dialects are supported, and the right one is detected automatically. (1) COMPONENT / COMPOSITE STRUCTURE: components, nested components, ports (port / portin / portout), provided and required interfaces, and assembly and delegation connectors. A composite-structure part puts its role in the label, as component "role : Type [multiplicity]" as alias. Nesting uses braces. (2) ACTIVITY / SWIMLANE FLOWCHARTS: |Lane| switches t…

ParameterTypeDescription
source *stringPlantUML text; @startuml/@enduml optional, one statement per line. Component example: component "gateway" as gw { portin telemetry ... }. Swimlane example: |Sensor| then start then :sample burst; then…
columnintegerRaw A4 page-guide index. Legacy fallback - prefer scrollId. Ignored when scrollId is given.
pageIdstringPage to draw on. Defaults to the page currently open.
scrollIdstringScroll (named column) to draw into - call list_scrolls first. The diagram lands below whatever is already in that column, like append_block. Defaults to the leftmost.
titlestringTitle shown on the diagram frame. Defaults to "Diagram".

create_diagram_mermaid

Draw a diagram on the page from MERMAID source. (For PlantUML source, use create_diagram_plantuml instead.) A DOCUMENTED SUBSET is read, and anything outside it comes back as a diagnostic instead of being drawn wrong. (1) FLOWCHART: "flowchart TD" / "flowchart LR" / "graph LR" as the first line, then nodes A[Label], A(Label) and A{Label}, and edges A --> B, A -->|guard| B and A --- B. Chains such as A --> B --> C work. (2) SEQUENCE: "sequenceDiagram" as the first line, then participant X (optionally "participant X as Label") and messages A->>B: text and A-->>B: reply. TWO THINGS TO EXPECT. Nod…

ParameterTypeDescription
source *stringMermaid text. The FIRST line must be flowchart/graph with a direction, or sequenceDiagram. Example: "flowchart LR" then A[Read sensor] --> B{Uplink up?} then B -->|yes| C[Send batch].
columnintegerRaw A4 page-guide index. Legacy fallback - prefer scrollId. Ignored when scrollId is given.
pageIdstringPage to draw on. Defaults to the page currently open.
scrollIdstringScroll (named column) to draw into - call list_scrolls first. The diagram lands below whatever is already in that column, like append_block. Defaults to the leftmost.
titlestringTitle shown on the diagram frame. Defaults to "Diagram".

bridge_status

Who else is working in this notebook. Several agents may be connected at once but only one may operate at a time, so call this when a tool comes back LOCKED, or before starting a long piece of work. Reports the connected notebook, every connected agent, which one holds the notebook, how long until it frees up, and whether that is you. This tool is never blocked. Note that a free result can go stale immediately -- another agent may take the lock before your next call -- so treat the LOCKED error as the real signal and this as a way to understand it.

create_diagram_svg

Draw an SVG onto the page as native PowerScroll shapes. Every element becomes an ordinary rectangle, circle, line or text run that the user can select and drag afterwards -- it is transpiled, NOT embedded as an image. THIS TOOL IS THE OPPOSITE OF THE OTHER TWO: create_diagram_plantuml and create_diagram_mermaid want semantics and compute every coordinate for you, whereas here YOU have already done the layout and the coordinates are the payload. Use this when you want exact placement, and one of the others when you want a diagram laid out well without doing the geometry yourself. Supported: svg…

ParameterTypeDescription
source *stringSVG markup. A root <svg> with a viewBox is best -- it fixes the scale and the corner lands where the diagram is placed.
columnintegerRaw A4 page-guide index. Legacy fallback - prefer scrollId.
pageIdstringPage to draw on. Defaults to the page currently open.
scrollIdstringScroll (named column) to draw into - call list_scrolls first. Lands below whatever is already in that column. Defaults to the leftmost.
titlestringTitle shown on the diagram frame. Defaults to "Diagram".

create_diagram_drawio

Draw a draw.io / mxGraph diagram onto the page. BY DEFAULT (v0.64+) the source is rendered by the embedded draw.io viewer into an exact vector snapshot — colours, gradients, curved edges, double-headed arrows, HTML labels, shadows and every built-in shape render exactly as diagrams.net shows them. The response then carries renderMode 'snapshot' and elementCount 0: a snapshot diagram has NO member nodes BY DESIGN — the stored XML remains the editable source, read_diagram returns it, and "Export as .drawio" emits it verbatim. Library stencil ICONS (mxgraph.aws4/mscae/cisco) are the one gap:…

ParameterTypeDescription
source *stringdraw.io / mxGraph XML. An <mxfile> or a bare <mxGraphModel>. Compressed (base64+deflate) pages are accepted — they are inflated before use.
columnintegerRaw A4 page-guide index. Legacy fallback - prefer scrollId.
pageIdstringPage to draw on. Defaults to the page currently open.
renderstringHow to draw it. 'snapshot' (default): exact image via the draw.io viewer. 'nodes': transpile into native, individually-editable shapes (lossy — see the subset above).
scrollIdstringScroll (named column) to draw into - call list_scrolls first. Lands below whatever is already in that column. Defaults to the leftmost.
titlestringTitle shown on the diagram frame. Defaults to "Diagram".

create_diagram

DEPRECATED - use create_diagram_plantuml, create_diagram_mermaid, create_diagram_svg or create_diagram_drawio instead, which name the language they take and each document their own subset. This name still works and sniffs the format from the source, but it will be removed. Behaviour is otherwise identical.

ParameterTypeDescription
source *stringDiagram source. The format is sniffed.
columnintegerLegacy fallback - prefer scrollId.
pageIdstringPage to draw on. Defaults to the open page.
renderstringdraw.io sources only: 'snapshot' (default) renders an exact image; 'nodes' transpiles to native shapes.
scrollIdstringScroll to draw into. Defaults to the leftmost.
titlestringTitle shown on the diagram frame.

list_scrolls

List the scrolls (named vertical columns) on a page, with how many blocks each holds. Call this before writing when a page may have more than one workstream on it: passing the returned scrollId to append_block keeps your blocks in their own column instead of stacking under someone else's. A block belongs to whichever scroll it physically sits in, so a block the user drags to another scroll moves with it.

ParameterTypeDescription
pageIdstringPage to inspect. Defaults to the page currently open.

create_scroll

Create a new named scroll on a page — a fresh vertical column to the right of the existing ones, with its title shown at the top on the canvas. Use this to keep a separate workstream (say "Open questions" beside "Research log") from interleaving with what is already there. Returns a scrollId to pass to append_block.

ParameterTypeDescription
title *stringTitle shown at the top of the scroll.
pageIdstringPage to add the scroll to. Defaults to the page currently open.

rename_scroll

Rename a scroll. The new title appears immediately at the top of that column on the canvas. Naming a previously untitled scroll is how its header first appears. Pass an empty title to untitle it: the header disappears and the page ceiling disarms — a plain page is one untitled scroll, not zero scrolls.

ParameterTypeDescription
scrollId *stringScroll to rename (from list_scrolls).
title *stringNew title. Empty string untitleds the scroll (header gone, ceiling off).

move_scroll

Move a scroll (named column band) left or right, or to an absolute column. Members, grouped ink and the band's own width travel with it; neighbouring scrolls shift to make room and cumulative offsets are recomputed. A diagram belongs to the band of its frame origin — the whole group moves, it is never split. Refuses with NOT_FOUND on an unknown id and PRECONDITION when the scroll is already at the named edge.

ParameterTypeDescription
scrollId *stringScroll to move (from list_scrolls).
directionstringStep one band left or right. Refused at the corresponding edge.
toColumnintegerAbsolute 0-based column to move to. Refused when already there or past an edge.

resize_scroll

Resize a scroll band by stable id. The width is clamped to PowerScroll's shared limits, persists on that page, and every node or stroke in bands to the right moves by the same delta. The resized band's own content stays fixed. One undo restores width and positions. list_scrolls reports the effective width.

ParameterTypeDescription
scrollId *stringScroll to resize (from list_scrolls).
width *numberRequested band width in canvas pixels; clamped by the app.

update_block

Replace the markdown of an existing block, found via read_page. Use this to revise content or tick a checkbox ("- [ ]" to "- [x]") rather than appending a duplicate block. If the block grows or shrinks, every occupant below it in the scroll (text, diagram frames, images, shapes, ungrouped ink) shifts by the height delta; frame members ride the frame. One undo. Returns displacedCount. A diagram-member id is refused (UNSUPPORTED) naming the owning diagram — redraw the source instead.

ParameterTypeDescription
blockId *stringBlock id from read_page.
markdown *stringNew markdown content.

rename_page

Retitle a page in the sidebar. If the page still opens with the "# Old title" heading block that create_page wrote, that block is retitled too so the two do not drift apart; a hand-edited heading is left alone.

ParameterTypeDescription
title *stringNew page title.
pageIdstringPage to rename. Defaults to the page currently open.
updateHeadingbooleanAlso rewrite the matching canvas H1. Default true.

move_page

Move a page into a different section. Section ids come from list_pages. A section must keep at least one page, so moving the only page out of a section is refused — create another page there first.

ParameterTypeDescription
toSectionId *stringDestination section id.
pageIdstringPage to move. Defaults to the page currently open.
toIndexintegerPosition within the destination section. Defaults to last.

rename_notebook

Rename the notebook itself (the title shown in the app and used for future Save As filenames). This does NOT rename the .html file already on disk — that keeps its current name until the user saves to a new location. The result reports the bound filename so you can tell them.

ParameterTypeDescription
filename *stringNew notebook name.

delete_page

Delete a page and everything on it. Cannot be undone from here — the app has no agent-facing undo — so ask the user before calling, then pass confirm:true. Refuses when the page is the last one in its section.

ParameterTypeDescription
confirm *booleanMust be true. Confirms the user agreed to the deletion.
pageIdstringPage to delete. Defaults to the page currently open.

delete_section

Delete a section AND every page inside it. This is the widest-reaching delete available — confirm the page list with the user first (list_pages shows what would go). Refuses when it is the notebook's only section.

ParameterTypeDescription
confirm *booleanMust be true. Confirms the user agreed to the deletion.
sectionId *stringSection to delete.

delete_scroll

Delete a named scroll (a column band). When the band holds ANY content — nodes, group members, or ink — content is REQUIRED: "delete" removes them with the band, "keep" closes the gap and leaves them where they are. There is deliberately no default. The old default was keep (confirm:true used to be a safe trim); a default flip would silently destroy callers that never passed the flag. An empty band needs no content param. Membership is group-aware: a diagram belongs to the band of its frame origin, and its members and grouped ink follow that verdict. A page must keep at least one scroll: a…

ParameterTypeDescription
confirm *booleanMust be true. Confirms the user agreed to the deletion.
scrollId *stringScroll to delete (from list_scrolls).
contentstringRequired when the band is not empty. "delete" removes the band's nodes, group members and ink with the scroll. "keep" closes the gap and leaves them. There is no default — the old default was keep,…
withBlocksbooleanDeprecated alias for content. true = delete, false = keep. Ignored when content is set. The response includes a deprecation notice.

delete_block

Delete a single markdown block by id. Use read_page first to get block ids and check you are removing the right one. Passed a diagram FRAME id, this cascades to the frame's members and grouped strokes — same primitive as delete_diagram, which names the act and reports the counts. Passed a diagram MEMBER id (a node whose groupId is owned by a diagram frame), the call is refused (UNSUPPORTED) naming the owning diagram and pointing at delete_diagram or the redraw path.

ParameterTypeDescription
blockId *stringBlock to delete (from read_page).
confirm *booleanMust be true. Confirms the user agreed to the deletion.

delete_diagram

Delete a diagram frame and everything that belongs to it: every node whose groupId is the frame id, and every stroke grouped with it. Use this when you placed a diagram you no longer want — delete_block on the frame id does the same cascade, but this tool names the act and reports how many members and strokes went. Occupants below the frame in the same scroll close the gap. An unknown id is NOT_FOUND. Passing a non-diagram node id is refused (the message names the type and points at delete_block). The bridge has no undo, so pass confirm:true once the user has agreed. Returns deletedMembers a…

ParameterTypeDescription
confirm *booleanMust be true. Confirms the user agreed to the deletion.
diagramId *stringId of the diagram frame (from read_page diagrams[].id or create_diagram).

get_background

Read the canvas look a page is actually drawn with: which guide style is active and which background colour. A page may override the notebook default, so the reply also carries "source" (whether each value came from the page or the notebook) and "notebookDefault". Call before set_background when you intend to restore the previous look afterwards.

ParameterTypeDescription
pageIdstringPage to read. Defaults to the active page.

set_background

Change the notebook's canvas look. "scroll" renders each column as one continuous vertical sheet with light page separators — best for long reading and for notes an agent is filling in. "pages" shows detached A4 cards, "grid" a dot grid, "none" a blank canvas. The setting is stored in the notebook itself, so it survives closing and reopening. Pass at least one of guideStyle or color. Scope defaults to "notebook" (every page that has not overridden it). Pass scope:"page" to change one page only — useful when a notebook wants a scrolling page of notes next to a grid page of diagrams.

ParameterTypeDescription
colorstringCanvas background colour. "paper" is a warm off-white.
guideStylestringGuide overlay to use.
pageIdstringPage to change when scope is "page". Defaults to the active page.
scopestringWhich layer to write. "notebook" (default) sets the default every page follows unless it overrides it, and leaves existing overrides alone. "page" overrides one page only.

save_notebook

Write the notebook back to the file it was opened from. Only works when the notebook is already bound to a file: the Save As picker needs a click from the user, which an agent cannot supply. Call this after a batch of edits so the work is on disk.

check_update

Check whether a newer PowerScroll release exists on GitHub. Reports the running version and the latest one. Note "checked": when false the API was unreachable or rate limited and the status is unknown — that is not the same as up to date.

run_update

Install the latest PowerScroll release into the current notebook file. This rewrites the .html on disk and reloads the app, which drops this bridge connection until the notebook reconnects. Ask the user before calling it, then pass confirm:true. A safety backup is downloaded first where the browser allows it. Run check_update first.

ParameterTypeDescription
confirm *booleanMust be true. Confirms the user agreed to the overwrite + reload.