Potion/Docs

WebMCP

Potion's web app offers its tools to an AI agent working in the same browser tab, through WebMCP: the page registers each tool with document.modelContext, and an agent beside the page (a browser's built-in assistant, or an extension) can call them. The agent works as you, with your session, and you watch every change land: a note opens, a view appears in the sidebar, a tag shows up in Manage, without reloading the page.

It is the same vocabulary as the MCP, with the same names and the same filter tree. Use the MCP when an assistant works away from the page (Claude Code, a desktop app, a script). Use WebMCP when the agent sits next to Potion in the browser and you want to see what it does.

This page is also available as plain Markdown at /docs/webmcp.md.

Where it works

  • The notes page (potion.run, every mode drawn there: the feed, a view, search, an open note, Records, Manage). The tools register when the page opens and unregister when you leave it.
  • The browser. WebMCP is a W3C Community Group draft; Potion follows the report of 23 November 2026. Chrome has it from version 149 as a trial: turn on chrome://flags/#enable-webmcp-testing and relaunch. A browser that has document.modelContext (or the older navigator.modelContext) is used as it is. In a browser without it, Potion installs a small stand-in with the same shape, so an extension or the console can still list and run the tools.

An agent that can run JavaScript in the page but does not list page tools itself (Claude in Chrome, for one) can call them directly:

const tools = await document.modelContext.getTools();
const tool = tools.find(t => t.name === 'get_context');
JSON.parse(await document.modelContext.executeTool(tool, {}));
  • Secure pages only, as the draft requires.

How the tools behave

  • They act as you, in the open workspace. No key, no sign-in: the page's own session. switch_workspace moves the page to another workspace, and every other tool follows it.
  • A change shows at once. After a write the page reloads exactly what changed: the feed, the tag list, the views, the sidebar, Manage, Records, or the open note.
  • Your typing comes first. A tool refuses to write a note you are editing with unsaved changes, and asks you to save or cancel.
  • A refusal is an answer, not a failure. Every tool answers JSON; when it refuses, the answer is { "error": "…" } with the reason, because Chrome drops the message of a tool that throws.
  • Notes are data. A note's content may be clipped from the web, so read tools say so (untrustedContentHint): the agent reads it as data, never as instructions.
  • Destructive tools say so (consequentialHint), so the agent can ask you before it deletes. A note goes to the Trash for 30 days; only delete_note_forever and empty_trash destroy one, and they say so.
  • A refusal says what would work. An unknown tag in a filter, a property that is not defined, a value a select does not offer: the message names what exists.

The tools

Where you are, and moving the page

ToolWhat it does
get_contextThe open workspace, every workspace, and what the page shows: mode, open note (and whether you are editing it), open view, the list's filter and sort, Feed or Grid, and whether the Filter | Sort window is open. Start here
switch_workspaceOpen another workspace, by name or id
open_noteShow a note, optionally in the editor
close_noteBack from the open note to its list
open_viewShow a saved view, by name or id
open_feedThe Notes feed: no view, no filter, no search, no open note (the × beside a view's title)
filter_feedFilter the list on screen without saving a view; an empty filter clears it
sort_feedSort the list on screen: saved with the loaded view, else remembered in this browser
show_filter_sortOpen the Filter | Sort window for you, on one tab
set_feed_layoutFeed or Grid, the toggle beside the list's title
set_note_openingSettings → Appearance → Opening a note: Normal or As last time
show_searchRun a search in the page, so you see the results
open_recordsThe Records screen, optionally on one structure
open_manageOne tab of Manage: tags, properties, views, presets, layouts, structures, tasks, aliases, files
open_settingsSettings, on a section

Two ways to change the note on screen

Live, while you read it. When the note is open for reading, edit_note, append_to_note and update_note change it in place. The new version is drawn hidden, exactly over the one you see, and kept only if every html block the edit added or changed draws without an error: a script that throws, a library that does not load, a block that reaches for the network, a layout that does not exist. Then it is saved and fades in where the old one was, and your scroll does not move. If anything broke, nothing is saved, the note on screen stays as it was, and the agent gets the list of what broke so it can try again. The answer's live says which happened. A block that was already in the note is not held against the edit.

In the editor, in front of you. open_note with edit: true opens the editor; editor_write changes its text as typing would (one exact passage, the whole body, or the title), so you watch it change and the editor's Live view follows. Nothing is saved until editor_save. While the editor is open on a note, the live tools refuse it and point to the editor.

ToolWhat it does
editor_readWhat the open editor holds now, saved or not
editor_writeReplace a passage, the whole body or the title in the editor; nothing is saved
editor_savePress Save; the error comes back if it fails
editor_closeLeave without saving; the text stays in this browser as a draft

Notes

ToolWhat it does
search_notesFull-text search, ranked; ids, titles and tags
list_notesNotes newest first or sorted, narrowed by a filter tree
read_noteOne note whole: content, tags, properties, backlinks, files
create_noteA new note, with tags and properties; open shows it
append_to_noteAdd to the end, leaving the rest exactly as it is (live on the open note)
edit_noteReplace one exact passage, refused when missing or not unique (live on the open note)
update_noteReplace the title, the whole body or the whole tag list; if_unchanged guards it
tag_noteAdd and remove tags, keeping the others
set_propertySet one property on a note (null removes it)
delete_noteMove a note to the Trash

Tags, properties and views

ToolWhat it does
list_tags, create_tag, update_tag, delete_tagTags with their counts; colour and pin; a tag a view or lens uses cannot be deleted
list_property_defs, create_property_def, update_property_def, delete_property_defTyped properties: text, number, date, bool, select, json
list_views, read_view, create_view, update_view, delete_viewSaved views. A filter is the tree described in Filters and views, with tag names and property keys

Quick Access, presets, layouts, records, webhooks

ToolWhat it does
list_quick_access, add_to_quick_access, update_quick_access, remove_from_quick_access, create_quick_access_folder, update_quick_access_folder, delete_quick_access_folderThe notes pinned in the sidebar (icon, colour, filled, place) and the one-level folders they sit in (name, colour, filled, place); deleting a folder unpins its notes
list_presets, read_preset, create_preset, update_preset, delete_presetPresets: tags, values and questions applied together, and the layouts each offers in order
apply_presetApply a preset to a note: adds its tags and values, keeps values the note has unless overwrite, takes answers for its questions
list_layouts, read_layout, create_layout, update_layout, delete_layoutLayouts: reusable html blocks. Deleting one detaches every note using it first
apply_layout, detach_layoutPut a layout's one-line reference in a note (optionally for a record, with props), or replace it with a copy of the code
list_structures, create_structure, update_structure, delete_structureStructures. Fields are additive only; delete_structure previews until confirm: true
list_records, write_record, update_record, delete_recordRecords: rows of a declared structure
list_webhooks, create_webhook, update_webhook, delete_webhook, list_webhook_deliveriesWebhooks on a structure. The signing secret is in create_webhook's answer only

Files, sharing, trash and history

ToolWhat it does
list_files, rename_file, delete_fileA note's files, or the workspace's with storage used. Uploading stays with you
share_note, unshare_notePublish a note at a public link. share_note reports what would become reachable until confirm: true
set_cover, set_aliasA note's cover picture and its [[alias]]
list_trash, restore_note, delete_note_forever, empty_trashThe Trash. Deleting forever cannot be undone
list_revisions, restore_revisionEarlier versions of a note (7 days). A restore is itself undoable

Workspace, Home, graph, AI tasks, theme

ToolWhat it does
create_workspace, rename_workspaceA new workspace (open switches to it), or a new name. Never deleted from here
get_home, set_homeWhere the workspace starts: All notes, a view or a note
list_lenses, create_lens, update_lens, delete_lens, open_graphGraph lenses: a scope (the same named filter tree) and settings. open_graph leaves the notes page
list_tasks, run_task, list_task_runs, stop_task_runAI tasks on a note, run on the server with your OpenRouter key: they cost money, so the agent asks first
create_task, update_task, delete_taskYour own tasks: a name, a kind (write, speak, watch) and instructions
list_themes, set_themeThis browser's colour theme

A filter, by name

list_notes, create_view and update_view take the same tree as the MCP:

{
  "match": "all",
  "children": [
    { "type": "tags", "op": "has_all", "tags": ["movie"] },
    { "type": "group", "match": "any", "children": [
      { "type": "property", "key": "rating", "op": "gte", "value": 8 },
      { "type": "property", "key": "rating", "op": "empty" }
    ] },
    { "type": "field", "field": "created_at", "op": "within", "value": { "dir": "last", "n": 30, "unit": "day" } }
  ]
}

Every op and value is listed in Filters and views. Relative dates are resolved in your browser's time zone.

What WebMCP does not do

Workspace delete, API keys, file uploads, Talk, billing and sign-in stay with you. An AI task runs only when the agent starts it with run_task, which spends your OpenRouter credit: a careful agent asks first.