devtools-mcp

v0.26.0
@foldkit/devtools-mcp Checked 3 days ago Published 1 month ago

MCP server exposing Foldkit DevTools to AI agents (Claude Code, Cursor, etc.)

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

foldkit_get_model

Snapshot the current Model from a connected Foldkit runtime. By default the response is summarized (large arrays/records/strings collapse to `_summary` placeholders) to keep payloads small for AI agents. Pass `path` (e.g. 'root.session.user') to narrow to a subtree, and `expand: true` to receive the literal value at that path. Returns `{ value, atPath, summarized }`.

ParameterTypeDescription
expand
path
runtime_id

foldkit_get_model_at

Snapshot a historical Model after a given history entry was applied. Pass `index: N - 1` to read the Model just before message N. Same `path`/`expand` semantics as foldkit_get_model. Indices outside the retained history range (older entries are evicted past the rolling buffer) are rejected with the readable range. For the initial Model (and the names of Commands returned from the application's `init`), use foldkit_get_init.

ParameterTypeDescription
index *integerAbsolute history index. Returns the Model state right after the entry at this index was applied. To inspect the Model immediately before message N, pass index N - 1. For the initial Model, use foldkit…
expand
path
runtime_id

foldkit_list_messages

List Message history entries from a Foldkit runtime. Filter server-side with `changed_paths_match` to ask in Model terms (which Messages touched this subtree), read the most recent entries with `from_end: true`, and paginate forward via `since_index` using the returned `maybeNextIndex` (the absolute index of the next matching entry). On busy histories (drag, scroll, keystroke flows), call foldkit_count_messages_by_tag first to learn what is worth filtering.

ParameterTypeDescription
changed_paths_match
from_end
limit
runtime_id
since_index

foldkit_count_messages_by_tag

Count retained Message history entries by tag, without payloads. Returns `{ counts: [{ tag, count }], totalCount, scannedFromIndex, scannedToIndex }` sorted by count descending. A cheap reconnaissance call before paging through history: it surfaces the high-frequency Messages worth filtering out, and with `changed_paths_match` it answers which Message tags touch a Model subtree. Accepts the same `since_index`/`changed_paths_match` filters as foldkit_list_messages.

ParameterTypeDescription
changed_paths_match
runtime_id
since_index

foldkit_diff_models

Diff the Models at two history indices server-side. Returns path-level changes `{ path, before, after }` sorted by path (numeric segments in numeric order), with values summarized. Each side is `{ _tag: 'Present', value }`, or `{ _tag: 'Absent' }` when the path does not exist on that side (a key or element that was added or removed). `from_index`/`to_index` follow foldkit_get_model_at semantics: the Model right after that entry was applied, with -1 for the initial Model. Pass `changed_paths_match` to narrow the diff to a Model subtree. Far cheaper than fetching two snapshots and diffing client…

ParameterTypeDescription
from_index *integerAbsolute history index of the diff baseline: the Model state right after this entry was applied. Use -1 for the initial Model.
to_index *integerAbsolute history index of the diff target: the Model state right after this entry was applied. -1 addresses the initial Model.
changed_paths_match
runtime_id

foldkit_get_message

Read a single Message history entry by absolute index. The response carries the SerializedEntry (tag, message body, commands, mountStarts, mountEnds, timestamp, `isModelChanged`, `changedPaths` for leaf-level mutations, `affectedPaths` adding their ancestor paths). Each entry in `commands` carries the Command name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `maybeSubmodelPath` (`None` before the result resolves, `Some([])` for a resolved top-level Command, or `Some(tags)` for a resolved Submodel Command). `mountStarts` lists Mounts that fired during…

ParameterTypeDescription
index *integerAbsolute history index of the entry to read.
runtime_id

foldkit_get_init

Read the runtime's initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. The init entry is the synthetic row at index -1 in the DevTools panel; this tool exposes the same data without time-travelling the runtime. `maybeModel` is `None` until the runtime has finished its first render and recorded init, then stays `Some` for the rest of the runtime's life. `commands` lists init-time Commands in the order they were produced, each with its name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwis…

ParameterTypeDescription
runtime_id

foldkit_get_runtime_state

Snapshot the runtime's DevTools state: history bounds, current paused/live status, and whether init is recorded. Returns `currentIndex` (the absolute index of the most recent Message, or -1 when none), `startIndex` (the earliest absolute index still retained in the rolling buffer), `totalEntries` (count of retained entries), `isPaused`, `maybePausedAtIndex` (`Some(index)` when paused, `None` otherwise), and `hasInitModel`. Use it to reason about what `foldkit_list_messages` and `foldkit_get_message` will see, and to detect whether the runtime is currently paused at a replayed snapshot.

ParameterTypeDescription
runtime_id

foldkit_list_keyframes

List the available keyframes (replayable Model snapshots) from a Foldkit runtime.

ParameterTypeDescription
runtime_id

foldkit_replay_to_keyframe

Time-travel a Foldkit runtime back to a previous Model snapshot. Pass `keyframe_index: -1` for the initial Model, or a non-negative index for the state right after that history entry. The runtime is paused at the snapshot until foldkit_resume is called.

ParameterTypeDescription
keyframe_index *integerIndex to replay to. Use -1 to jump to the initial Model (before any messages). Use a non-negative index to jump to the Model state right after that history index. Call foldkit_list_keyframes for the c…
runtime_id

foldkit_resume

Resume normal execution of a Foldkit runtime that was paused by foldkit_replay_to_keyframe.

ParameterTypeDescription
runtime_id

foldkit_get_message_schema

Describe the Message Schema for a Foldkit runtime so agents can construct valid payloads for `foldkit_dispatch_message`. Call with no arguments to receive a small variant index (every top-level variant's `_tag`, its payload field names, and which payload fields are themselves tagged-union shapes). Then call with `variant_tag: "ChosenVariant"` to drill in. The argument is a dot-separated path of variant `_tag` values: each segment names a variant, and the walker steps through the variant's single tagged-union payload field to reach the next. So `"GotMobileMenuDialogMessage"` narrows one level;…

ParameterTypeDescription
runtime_id
variant_tag

foldkit_dispatch_message

Dispatch a Message into a Foldkit runtime, as if the application itself produced it. Requires the runtime to have configured DevToolsConfig.Message; without it, dispatch is rejected. Call `foldkit_get_message_schema` with no arguments to enumerate the variants, then with `variant_tag` to learn one variant's exact payload shape, before constructing the Message object. The runtime decodes the payload and returns a clean error if it doesn't match. To dispatch several Messages in order with one call, use foldkit_dispatch_messages.

ParameterTypeDescription
message *objectA Foldkit Message object to dispatch into the runtime. Must match the runtime's Message Schema. Call `foldkit_get_message_schema` with no arguments to see the available variant tags, then `foldkit_get…
runtime_id

foldkit_dispatch_messages

Dispatch an ordered batch of Messages into a Foldkit runtime in one call, first to last, as if the application produced them in quick succession. Prefer this over repeated foldkit_dispatch_message calls when staging state that takes several Messages: reproducing a bug, filling a form, or building a history fixture. Takes 1 to 100 Messages. Validation is all-or-nothing: the runtime decodes every payload against the Message Schema before dispatching any of them, and one invalid entry rejects the whole batch with an error naming its zero-based position, so there is never a partially applied prefi…

ParameterTypeDescription
messages *arrayAn ordered list of Foldkit Message objects to dispatch into the runtime, first to last. Must hold between 1 and 100 Messages. Each must match the runtime's Message Schema; call foldkit_get_message_sch…
runtime_id

foldkit_list_runtimes

List Foldkit runtimes (browser tabs) connected to every Foldkit dev server under the project root, or else to every dev server at the nearest root that encloses the project root, oldest dev server first. Each runtime carries `projectRoot`, the root of the dev server it belongs to, unless the MCP server uses a fixed relay address.