Repository navigation
Agent MCP Capabilities
The in-app tools an agent reaches on each tab type, and the rules that apply to all of them. The permission model behind the gating is on Agent access and permissions. See Additions at the end for tools that arrived after the per-tab sections were written.
Studio exposes its in-app capabilities to the AI agent as an in-process MCP server named
studio (src/shared/electron/ai/claude-agent-provider.ts). Tool handlers do not touch the
main process's own state: each call is bridged back into the renderer
(src/shared/electron/ai/studio-tools.ts → AiRuntime capability registry), so the agent acts
on the live editor/terminal state — including unsaved edits — exactly as the user sees it.
Which tools the server registers is decided per run by the surface the hosting tab declares
(AgentSurface = 'editor' | 'terminal' | 'binary' | 'api' | 'project',
src/shared/api/ai/ai-tool-surface.ts), and
each tool is bound to the owning tab (owningTabId), so an agent docked to one tab cannot
act on another. The Claude (Agent SDK) provider registers the tools as a real MCP server
(mcp__studio__<tool>); the Vercel AI SDK and Ollama providers expose the identical tool set as
plain AI-SDK tools (src/shared/electron/ai/ai-sdk-stream.ts) with the same mode and posture
rules enforced in the executors, so both capabilities and permission gating are
provider-independent (see Cross-cutting rules).
| Tab type | Surface | Studio MCP tools | Conversation scope |
|---|---|---|---|
| Code | editor |
read_active_document, edit_active_document, insert_into_active_document, replace_active_document
|
file (document id) |
| Markdown | editor |
read_active_document, edit_active_document, insert_into_active_document, replace_active_document
|
file (document id) |
| Terminal | terminal |
read_terminal_output, write_terminal_input — all other tools denied (except ask_user) |
per terminal tab |
| Agent | project |
ask_user only — the built-in Agent SDK tools are this surface's capability set (see below) |
global |
| Workspace | editor |
editor tools (resolve to the focused editor in the document well) |
workspace (root) |
| Repository | editor |
editor tools (resolve to the focused editor in the document well) |
repository (root) |
| Binary | binary |
read_binary_overview, read_binary_bytes, read_binary_selection, read_binary_disassembly, patch_binary_bytes, insert_binary_bytes, delete_binary_bytes, write_binary_assembly
|
per binary tab |
The tool name constants live in src/shared/api/ai/ai-tool-surface.ts; the conversation-scope
kinds (global / workspace / repository / file) in
src/shared/api/agent-conversation-channels.ts.
Every surface additionally registers ask_user: the agent asks the user a question —
free-form, or with suggested choices (each a short label plus an optional description, rendered
as a radio list with the recommended choice first) — and the run blocks until they answer,
decline, or stop the run. It is auto-allowed everywhere — asking is not a mutation, and the answer itself is the gate —
and it works on every provider, because the round-trip rides the provider-agnostic run context
(requestInput, mirroring the permission plumbing) rather than a provider hook. The question and
its answer land in the transcript as an input-request item and persist with the conversation.
The code view docks an agent side panel (code-agent-panel) that hosts the shared
AgentConversationPanel with the tab's id and the default editor surface.
-
read_active_document— returns the full text of this tab's Monaco document, including unsaved edits (auto-allowed; also available in Chat mode). -
edit_active_document— string-anchored edit: replaces one exact occurrence ofold_stringwithnew_string(replace_allfor every occurrence; emptynew_stringdeletes). The anchor must match uniquely — ambiguous or missing anchors fail with recovery guidance for the model. Applied as a granular Monaco range edit, so undo stays per-edit and the rest of the document is untouched. -
insert_into_active_document— inserts text before/after a uniquely-matching anchor string, or at the document's start/end. -
replace_active_document— replaces the document's entire text; the prompt appendix steers the model to the granular tools for targeted changes and reserves this for full rewrites. - All mutating editor tools are undoable in-editor edits: auto-allowed in Agent mode (the change is visible and undoable), withheld entirely in Chat mode.
- The system prompt (
STUDIO_PROMPT_APPENDIX) steers the model to put generated/edited content into the editor via these tools rather than writing files to disk. - Conversations are scoped to the file, so each document keeps its own history.
Identical wiring to Code (markdown-agent-panel → editor surface, file-scoped conversations),
with one difference in resolution: the capability handler
(src/features/agent/angular/agent-editor-capabilities/agent-editor-capabilities.ts) consults
the markdown command seam first, so the agent reads the live markdown source of the Crepe
editor (including unsaved edits). Mutations round-trip through the source: the edit/insert is
applied to the markdown text and the result is parsed back into the editor, so anchors match
exactly what read_active_document returned.
The terminal view docks terminal-agent-panel, which sets surface="terminal". This is the
most confined surface — the agent is deliberately locked to its terminal:
-
read_terminal_output— returns the recent output shown in the owning terminal (auto-allowed). -
write_terminal_input— types text into the terminal, running it as a command by default (submit: falsetypes without executing). Never auto-allowed byallowedTools; it flows through the permission posture, and Chat mode withholds it entirely. -
Everything else is denied (
ask_userexcepted — it is auto-allowed before the confinement check applies). The Claude provider'scanUseToolrejects every other tool, including the built-in file-system and shell tools — the agent inspects files by runningls/cat/grepin the terminal the user is watching, not through hidden tooling. TheTERMINAL_PROMPT_APPENDIXtells the model exactly that.
The standalone Agent tab (agent-view) is a full-page chat with a global conversation scope
and the dedicated project surface. It has no document of its own, so the studio server carries
only ask_user — the run's capability set is otherwise the built-in Agent SDK tools: with a
workspace open (or files/folders attached), Read/Glob/Grep are auto-allowed, and edits,
shell, and other built-ins are available subject to the permission posture, with the workspace
root as the working directory (falling back to the home directory). The prompt appendix
(PROJECT_PROMPT_APPENDIX) tells the model it is undocked and that on-disk changes surface in
the IDE (editors follow external changes; explorers refresh live). This is the surface for
project-wide work.
Note the provider caveat below: on the Vercel AI SDK and Ollama engines — which have no built-in
tools — a project run carries only ask_user.
The workspace view's dock blueprint includes the shared AgentPanel, which hosts
AgentConversationPanel with no owning tab id — the run is unscoped. The editor tools then
fall back to the focused editor: markdown first, then code. So the agent reads/edits whatever
document is active in the workspace's document well, tracking the user's focus rather than a
fixed document.
- Conversations are scoped to the workspace root (
workspace:<path>), so each workspace keeps its own history; before a folder is open the panel uses the global bucket. - The workspace root is the run's working directory, and
Read/Glob/Grepare auto-allowed for project exploration.
Same mechanics as Workspace — the repository (source-control) view's dock blueprint stacks the
shared AgentPanel behind the Commit panel, unscoped, editor surface — but the conversation
context resolves to the git repository root (repository:<root>), lazily, so it tracks the
repository bind (source-control-view.ts). The conversation is provided at the view level
rather than inside the dock panel, so switching the Commit/Agent tool stack does not destroy the
transcript or an in-flight run.
read_active_document / replace_active_document resolve to the focused editor in the
document well when one is open (e.g. a file opened from a commit); with only diff views open
there may be no active document to resolve.
The binary (hex editor) view docks binary-agent-panel with surface="binary" — the richest
in-app tool set:
-
read_binary_overview— path, size, container format, architecture, disassembly availability, current cursor/selection. The prompt appendix tells the model to call this first. -
read_binary_bytes— hex + ASCII dump of a byte range (bounded window, default 256 bytes), so GiB-scale files are read incrementally. -
read_binary_selection— hex + ASCII dump of the user's current selection. -
read_binary_disassembly— assembly listing for a byte range when the format is natively disassemblable. -
patch_binary_bytes— overwrites bytes at an offset (length unchanged) as an unsaved, undoable edit the user reviews. -
insert_binary_bytes/delete_binary_bytes— length-changing edits: insert a hex run before an offset (the file size appends) or remove a byte range. Both shift every subsequent offset — the tool results state the new size and the shift, and warn that earlier reads are stale; the descriptions warn they typically corrupt structured executables (headers reference absolute offsets) and are intended for blobs/data files. Backed by the piece-table document model, so they are unsaved, undoable edits like the patch. -
write_binary_assembly— assembles x86/x64 assembly text (Intel syntax, one instruction per line) and writes it at an offset, so the model edits at the instruction level instead of hand-assembling hex. The file length is never changed: the model passes the length of the range it is replacing — shorter code is padded with NOPs, and longer code is rejected (with the assembled size, so it can revise) rather than silently shifting the following instructions. The result echoes the bytes written and the round-trip disassembly of the written range. Assembly runs in the main process through DefAssembler (@defasm/core, ISC-licensed pure JavaScript) — covering x86 and x64 only. ARM/ARM64 binaries can be disassembled (read) but not assembled; those and any non-disassemblable format report that assembly is unavailable, mirroring the disassembly tool. Code is assembled at address 0 (DefAssembler takes no base address), so absolute-target branches will not resolve — PC-relative operands do. - The four read tools are auto-allowed; the four mutating tools (
patch/insert/delete/write_binary_assembly) always flow through the permission posture, and Chat mode withholds them.
The renderer formats all dumps/listings, so presentation lives in one place; the tools relay the
rendered text. Read-only project exploration (Read/Glob/Grep) is also auto-allowed when a
workspace or attached context is present.
These apply to every tab type:
-
Modes — every agent panel offers Agent and Chat modes. Chat is read-only: mutating
studio tools are not registered at all, built-in read-only exploration (
Read/Glob/Grep) is allowed, and everything else is denied without prompting (READ_ONLY_APPENDIXtells the model to advise instead of act). -
Permission posture (
prompt/auto-edits/auto-all, a setting) — read-only tools are always allowed;auto-editsadditionally auto-allows the built-in file-edit tools (Write/Edit/MultiEdit/NotebookEdit) but still prompts for shell/exec;promptasks before anything mutating or executing. In-app editor tools are auto-allowed in Agent mode regardless of posture because the result is visible and undoable in the editor; the terminal write and binary patch tools are the deliberate exceptions and follow the posture. -
Provider parity — the Claude provider enforces mode/posture through the SDK's
canUseToolhook. The AI SDK has no such hook, so the Vercel and Ollama providers enforce the same rules in the tool set itself (ai-sdk-stream.ts): chat mode registers only the read tools, and the gated executors (terminal write, binary writes) ask through the shared permission round-trip unless the posture isauto-all— so the posture selector means the same thing on every provider. Those providers still have no built-in file/shell tools, so their reach is limited to the studio tools — and on theprojectsurface (whose only studio tool isask_user) they can do nothing but converse and ask. -
Edit preview (accept/reject) — under the
promptposture in agent mode, the in-app editor mutations (edit/insert/replace_active_document) no longer apply straight through: the change is staged in the renderer, a diff opens in the document well for code targets (markdown has no diff editor, so its card carries the summary alone), and the transcript card asks Yes / Yes, and automatically accept edits / No. "Yes, and automatically accept" applies and auto-accepts further edit previews for the rest of the app session. Rejecting discards the staged change and tells the model not to retry as-is.auto-edits/auto-allpostures skip the preview and apply directly, as before. Runs on every provider (the flow lives in the shared tool helpers and the renderer capabilities). -
Permission broker (remembered decisions) — every gated prompt is brokered in the main
process (
AiManager.requestPermission→PermissionRuleStore): the prompt offers just this once / for this session / for this workspace / always, and a remembered grant short-circuits future asks with no prompt at all. Session grants die with the app; workspace (keyed by the run's workspace root) and always grants persist toagent-permission-rules.jsonunderuserData. Only grants are remembered — denials never are, so a mis-click cannot silently brick a tool. Rules key on the tool's display name and apply across providers, since both the Claude and AI-SDK paths route through the same broker. (Per-tool default policies and an audit log are #190's territory; the rule store is designed to be shared with it.) -
Interactive input —
ask_userblocks the run on the user's answer through the same main-process round-trip as permissions (AiManager.requestInput→input-requestevent →resolveInput). Declining ("Skip") or stopping the run resolves the question with no answer, and the model is told to continue conservatively. Available in Chat mode: asking is read-only. -
Attached context — Attach File / Add Folder pass paths by reference (
contextPaths); the prompt preamble lists them and the built-inRead/Globtools are auto-allowed so the agent can read them even without an open workspace. -
Sessions — each conversation resumes its provider session (
resumeSessionId) so earlier turns' context (including tool calls) persists across turns within a conversation scope.
The per-tab sections above describe the tool set as it stood in July 2026. The tools below arrived
afterwards; the rules in Cross-cutting rules apply to them unchanged. The
authoritative list is src/shared/api/ai/ai-tool-surface.ts; how each surface's set is assembled is in
src/shared/electron/ai/claude-agent-provider.ts (Claude) and ai-sdk-stream.ts (every other
provider).
-
A fifth surface,
api— the API Explorer tab. Its tools arelist_api_requests(read-only),create_api_request,update_api_request,send_api_requestandset_api_variable. A send by the agent is checked against the allowed/denied network locations before it leaves; a user's own send never is. -
Workbench tools on every surface (withheld only in read-only Chat mode):
open_documentopens a new markdown or code tab holding something the agent wrote — unsaved, touching nothing on disk;save_documentoffers to save one of those through the OS save dialog and is meant to be called only when the user asked to keep it;open_fileopens one of the user's workspace files in their editor;open_terminalopens a new terminal tab in the default shell. Opening a tab is an application action rather than a surface one, so a terminal-, binary- or API-docked agent reaches the same tab registry as an editor-docked one. -
Run-configuration tools on the workspace-scoped surfaces (
editorandproject, neverterminal,binaryorapi):list_run_configurations(read-only, auto-allowed),save_run_configurationsanddelete_run_configurations(gated writes) act on the open workspace's.studio/workspace.json. Every write is validated as a whole — duplicate ids, compound members naming nothing, cycles — and refused with a reason the agent can act on. -
Editor additions:
set_active_document_languagechanges the tab's syntax, andrun_active_documentruns the live editor content in the code view's terminal and returns the output and exit status, so the agent can verify what it wrote. The edit-preview flow is expressed as tools too —preview_active_document_edit,commit_edit_preview,cancel_edit_preview. -
Clarifying questions on the Claude provider ride the SDK's built-in
AskUserQuestionrather than the customask_usertool; it is rendered locally (and forwarded under remote control), allowed on every surface and in every mode, and never counts as a mutation. The other providers keepask_user.
Using Studio
Contributing
How it works
- Architecture
- Runtime seams
- Agent access and permissions
- Agent MCP capabilities
- Agent surfaces, prompts and skills
- Source control
- Plugins
- Package managers
- Language servers — capability matrix
- Language servers — adding a server
- Setup wizard
- Container engines
Decisions