Tools reference: your window, files and terminals
On this page
- Try it
- Where am I
- context_info
- tab_list
- doc_list
- stack_list
- notes_read
- editor_selection
- usage_read
- account_list
- Show you things
- tab_open
- tab_close
- tab_reveal
- stack_add
- stack_remove
- web_open
- web_reload
- session_status
- diff_show
- layout_arrange
- Your content
- notes_append
- doc_save
- doc_propose
- Terminals
- terminal_open
- terminal_read
- terminal_close
Where am I, what is open, open a file or page, propose an edit, leave a note, run a terminal.
These 24 tools are part of Cortex control. They tell an agent what is on your screen and let it show you things, always inside the session's own context. For the whole list, see Cortex tools reference.
Who can call them. Every session Cortex starts while Cortex control is on in Settings → MCP. Minis in rooms and task runs do not get them. An applet can call them with cortex.tools.call when the manifest lists the tool and its configuration allows it.
Tiers. Read-only tools never ask. Window tools only change what you see, can be undone, and never ask. Tools that touch your content or start a process ask you in a card over the session. See What agents ask you before they act.
Focus. None of these tools brings Cortex to the front, switches the context in front or moves the keyboard. A tab opened while you type in that group opens behind the selected tab. The window tools share one budget of 20 calls per second per session.
Try it
You don't call these tools yourself: you ask in your own words, in a session, and the agent picks the tools. Saying with Cortex or naming what you want to see (a view, a tab, the Stack) makes it reach for them.
| You type | What the agent uses |
|---|---|
| Open the variance note and the budget workbook side by side | tab_open, layout_arrange |
| Put the three contracts you just compared on the Stack | stack_add |
| Show me the diff of your changes to the handbook before you save them | diff_show, then doc_propose |
| Add a line to the context notes: counter-proposal due Thursday | notes_append |
| Run the test suite in a terminal tab and tell me what fails | terminal_open, terminal_read |
| How much of my Claude plan is left this week? | usage_read |
Where am I
context_info
Where this session runs: the context's name and folder, its extra roots, its colour, the default account, whether it is the context in front, and this session's title and account. It is cheap, so agents call it first. No parameters. Read-only.
tab_list
The context's open tabs by group: kind (file, session, transcript, terminal, page, view), title, path or address, which tab is selected in each group, which group has the focus, and which tabs this session opened. It gives titles and paths only, never contents. No parameters. Read-only.
doc_list
Files of the context that you have open with unsaved changes, and files in conflict with the disk, the context's note included. dirty_seconds says how long an unsaved file has waited. Agents check it before editing a file. No parameters. Read-only.
stack_list
The entries on the Stack that belong to this context: kind, title, path or address, and whether this session put it there. No parameters. Read-only.
notes_read
The context's note (NOTES.md at its root, or the file you chose), as you have it, unsaved text included, and whether it holds unsaved text. No parameters. Read-only.
editor_selection
The text you selected in a file of the context, with its path and line range, so "explain this" needs no copy and paste. It works in a plain-text file, or a Markdown, HTML or JSON file in Source mode. It is empty when nothing is selected. A Markdown tab in the visual editor says to switch to Source. No parameters. Read-only.
usage_read
The usage meters of this session's account: each window's share used and when it resets. A long task can use it to pace itself. No parameters. Read-only.
account_list
The accounts a session may name in session_start: id, name, agent, whether it is the context's default, and its most-used meter (label, share used, reset time) from the last reading. It never gives settings, folders, keys or sign-ins. No parameters. Read-only.
Show you things
tab_open
Opens a file of the context in a tab, at a line, at a range of lines (highlighted whole) or at a Markdown heading. A file you already have open is shown in your tab, which stays yours.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
path |
string | yes | Relative to the context root, or absolute inside the context and its extra roots. |
line |
integer | no | The line to open at, from 1. |
end_line |
integer | no | The last line of a range: line through end_line are highlighted. |
heading |
string | no | A Markdown heading's text. The tab opens there. |
where |
string | no | beside (default, next to the session), focused (your focused group) or new-split. |
preview |
boolean | no | A preview by default: the next preview replaces it. false keeps the tab. |
Returns. The tab id, and reused and mine. A reused tab is yours, so the session cannot close it. At most 5 tab_open and terminal_open calls per second per session.
{ "path": "src/auth/login.ts", "line": 42, "end_line": 58 }
tab_close
Closes a tab this session opened. Your own tabs are never closed, and neither is one you have edited since without saving.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
id |
string | yes | A tab id from tab_open or tab_list. |
tab_reveal
Selects a file in the sidebar's Context files, with its folders expanded. It works when the context is the one in front.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
path |
string | yes | A file or folder of the context. |
stack_add
Puts a file of the context, a web page (https or localhost) or one of the context's transcripts on the Stack. Give exactly one of path, url and session.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
path |
string | one of three | A file of the context. |
url |
string | one of three | https://… or http://localhost…. |
session |
string | one of three | A session id of this context. |
Returns. The entry id.
stack_remove
Removes a Stack entry this session put there.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
id |
string | yes | An id from stack_add or stack_list. |
web_open
Opens a web page in a tab beside the session: any https address, or http on localhost, such as a dev server. A page you already have open there is shown in your tab, which stays yours.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
url |
string | yes | https://… or http://localhost:…. |
Returns. The tab id, with reused and mine.
web_reload
Reloads a web tab this session opened, for example after an edit.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
id |
string | yes | A tab id from web_open. |
session_status
Sets this session's one-line status, such as "tests 38/120". It shows on the session's tab and header, and other sessions read it through session_list. It is cleared at the next prompt, or when text is null.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
text |
string or null | yes | At most 80 characters. Null clears it. |
diff_show
Shows you, in a view beside the session, a file of the context as you have it (unsaved edits included) against a git revision, another file or a text. It is read-only. To propose a change you can accept, use doc_propose.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
path |
string | yes | The file, the "after" side. |
against |
string | no | A git revision for the "before" side. Default HEAD. |
against_path |
string | no | Another file of the context as the "before" side. |
against_text |
string | no | A text as the "before" side. |
Returns. The view id.
layout_arrange
Puts the window in one of three named arrangements. It does not take geometry.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
name |
string | yes | review (a group beside the session, and the Stack open), side-by-side (two files in two groups beside the session) or focus (every group but the session's collapsed into chips, one click brings each back). |
paths |
array of strings | for side-by-side |
The two files. |
Your content
notes_append
Appends a dated block to the context's note: what was done, what is left, where to look. It never rewrites what is there. Markdown, at most 4 000 characters.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
text |
string | yes | The Markdown to append. |
Asking. Cortex asks you the first time a session writes to the note, whatever your settings say. It is refused while you have unsaved text in the note.
doc_save
Saves files you have unsaved in the context, all of them or the paths given, so a build or a test sees what you typed.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
paths |
array of strings | no | Only these files. Without it, every unsaved file. |
Asking. Every time, with the files named. A file in conflict with the disk is never saved.
doc_propose
Proposes the whole new text of a file. You see it as a diff over the file as you have it. You Accept (Cortex writes it through your document and saves), Edit (the file opens with the proposal applied, unsaved) or Reject. It waits for your answer. See Review before apply.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
path |
string | yes | A file of the context. A new file is created on Accept. |
text |
string | yes | The file's whole new text. |
summary |
string | no | One or two lines: what changes and why. |
timeout |
integer | no | Seconds to wait, at least 10. |
Returns. outcome: accepted, edited, rejected, closed, timeout (the proposal is withdrawn) or stale (the file changed meanwhile and nothing was written).
Asking. The proposal is the question. While Steer edits of unsaved files to a proposal is on, an agent's own write to a file with your unsaved changes is refused and pointed here.
Terminals
terminal_open
Opens a terminal tab beside the session in a folder of the context, optionally with a command typed at its prompt.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
folder |
string | no | Relative to the context root. Default the root. |
command |
string | no | Typed at the prompt. |
run |
boolean | no | false (default) leaves the command for you to run with Return. true runs it once you allow it. |
Returns. The tab id. Asking. Running asks every time, unless you allowed it for the session. Typing without running does not ask. Control characters in the command become spaces, so what you read is what is typed.
terminal_read
The last lines of a terminal this session opened, such as its dev server or build. Never one of your own terminals. Read-only.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
id |
string | yes | A tab id from terminal_open. |
lines |
integer | no | From 1 to 500. |
terminal_close
Ends a terminal this session opened and closes its tab. It does not ask, since it acts only on what the session started.
| Parameter | Type | Required | Meaning |
|---|---|---|---|
id |
string | yes | A tab id from terminal_open. |
Something wrong or missing? Tell us