Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Tools

The extension registers two kinds of tools: built-in tools, which only this extension provides, and command-backed tools, which run one command each. The tools setting adds command-backed tools.

Hints: R = readOnlyHint, C = consequentialHint, U = untrustedContentHint. In the inputs, bold means required. The results follow the result protocol.

Built-in tools

These tools are always registered, unless disabledTools names them. Tools from the settings cannot use their names.

ToolInputsWhat it doesHints
get_contextnoneDescribes the page: documents, current editor, kernels, file browser directory, dialogs, pending callsR, U
list_all_commandsquery, limit (50)Finds commands: every word of query must appear in the id, label, caption or usageR, U
execute_commandcommand_id, argsRuns any command. args is an object or a JSON stringC, U
answer_dialogbutton, dialogIdClicks a button (label or 0-based index) of the dialog that is shown, then returns the result of the call that waitsC, U
wait_for_resultpendingId, timeoutWaits for a pending call and returns its final resultR, U

get_context

The result has these fields:

list_all_commands

The search ignores case. Blocked commands are not listed. The result is {success, commandCount, commands}, where commandCount is the number of matching commands and commands lists the first limit of them. Each command has:

execute_command

execute_command does not check args. Most notebook and console commands act on the active document: to target another open notebook or console, add "semanticWidget": "<widget id from get_context>" and "activate": false to args. Only notebook:* and console:* commands take semanticWidget and widgetId. Other commands, such as the menu commands that run them, act on the current widget: with these arguments, execute_command returns an error and does not run the command.

Default tools

These tools are registered while their command exists. ai: means jupyterlab-ai-commands:. Fixed arguments are hidden from the agent and always passed to the command.

ToolInputsCommandFixed argumentsHints
open_documentpath, factory, optionsdocmanager:open
list_directorypath, includeHiddenai:list-directoryR, U
read_filefilePathai:get-file-infobackground: true, createWidget: falseR, U
write_filefilePath, contentai:set-file-contentbackground: true, save: true, showDiff: falseC
create_filefileName, fileType, content, cwdai:create-filebackground: true
create_notebookname, languageai:create-notebookbackground: true
read_notebooknotebookPathai:get-notebook-contentbackground: true, createWidget: falseR, U
read_cellnotebookPath, cellIdai:get-cell-infobackground: true, createWidget: falseR, U
add_cellnotebookPath, referenceCellId, content, cellType, positionai:add-cellbackground: true
edit_cellnotebookPath, cellId, contentai:set-cell-contentbackground: true, diffMode: "unified", showDiff: falseU
delete_cellnotebookPath, cellIdai:delete-cellbackground: trueC
run_cellnotebookPath, cellIdai:run-cellbackground: true, recordTiming: trueC, U
save_notebooknotebookPathai:save-notebookbackground: true
run_codekernelId, code, stopOnErrorai:execute-in-kernelsilent: false, storeHistory: trueC, U
interrupt_kernelkernelIdjupyter-webmcp:interrupt-kernel
restart_kernelkernelIdjupyter-webmcp:restart-kernelC

Input checks

Browsers do not check the input against the schema, and commands ignore unknown arguments. So the command-backed tools check the input before they run the command: