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-testingand relaunch. A browser that hasdocument.modelContext(or the oldernavigator.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_workspacemoves 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; onlydelete_note_foreverandempty_trashdestroy 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
| Tool | What it does |
|---|---|
get_context | The 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_workspace | Open another workspace, by name or id |
open_note | Show a note, optionally in the editor |
close_note | Back from the open note to its list |
open_view | Show a saved view, by name or id |
open_feed | The Notes feed: no view, no filter, no search, no open note (the × beside a view's title) |
filter_feed | Filter the list on screen without saving a view; an empty filter clears it |
sort_feed | Sort the list on screen: saved with the loaded view, else remembered in this browser |
show_filter_sort | Open the Filter | Sort window for you, on one tab |
set_feed_layout | Feed or Grid, the toggle beside the list's title |
set_note_opening | Settings → Appearance → Opening a note: Normal or As last time |
show_search | Run a search in the page, so you see the results |
open_records | The Records screen, optionally on one structure |
open_manage | One tab of Manage: tags, properties, views, presets, layouts, structures, tasks, aliases, files |
open_settings | Settings, 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.
| Tool | What it does |
|---|---|
editor_read | What the open editor holds now, saved or not |
editor_write | Replace a passage, the whole body or the title in the editor; nothing is saved |
editor_save | Press Save; the error comes back if it fails |
editor_close | Leave without saving; the text stays in this browser as a draft |
Notes
| Tool | What it does |
|---|---|
search_notes | Full-text search, ranked; ids, titles and tags |
list_notes | Notes newest first or sorted, narrowed by a filter tree |
read_note | One note whole: content, tags, properties, backlinks, files |
create_note | A new note, with tags and properties; open shows it |
append_to_note | Add to the end, leaving the rest exactly as it is (live on the open note) |
edit_note | Replace one exact passage, refused when missing or not unique (live on the open note) |
update_note | Replace the title, the whole body or the whole tag list; if_unchanged guards it |
tag_note | Add and remove tags, keeping the others |
set_property | Set one property on a note (null removes it) |
delete_note | Move a note to the Trash |
Tags, properties and views
| Tool | What it does |
|---|---|
list_tags, create_tag, update_tag, delete_tag | Tags 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_def | Typed properties: text, number, date, bool, select, json |
list_views, read_view, create_view, update_view, delete_view | Saved views. A filter is the tree described in Filters and views, with tag names and property keys |
Quick Access, presets, layouts, records, webhooks
| Tool | What 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_folder | The 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_preset | Presets: tags, values and questions applied together, and the layouts each offers in order |
apply_preset | Apply 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_layout | Layouts: reusable html blocks. Deleting one detaches every note using it first |
apply_layout, detach_layout | Put 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_structure | Structures. Fields are additive only; delete_structure previews until confirm: true |
list_records, write_record, update_record, delete_record | Records: rows of a declared structure |
list_webhooks, create_webhook, update_webhook, delete_webhook, list_webhook_deliveries | Webhooks on a structure. The signing secret is in create_webhook's answer only |
Files, sharing, trash and history
| Tool | What it does |
|---|---|
list_files, rename_file, delete_file | A note's files, or the workspace's with storage used. Uploading stays with you |
share_note, unshare_note | Publish a note at a public link. share_note reports what would become reachable until confirm: true |
set_cover, set_alias | A note's cover picture and its [[alias]] |
list_trash, restore_note, delete_note_forever, empty_trash | The Trash. Deleting forever cannot be undone |
list_revisions, restore_revision | Earlier versions of a note (7 days). A restore is itself undoable |
Workspace, Home, graph, AI tasks, theme
| Tool | What it does |
|---|---|
create_workspace, rename_workspace | A new workspace (open switches to it), or a new name. Never deleted from here |
get_home, set_home | Where the workspace starts: All notes, a view or a note |
list_lenses, create_lens, update_lens, delete_lens, open_graph | Graph 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_run | AI 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_task | Your own tasks: a name, a kind (write, speak, watch) and instructions |
list_themes, set_theme | This 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.