Skip to content

Register a RunBlocks Language Model Tool for AI agent support #318

Description

@Artmann

Register a RunBlocks Language Model Tool so AI agents in VS Code, Cursor and Copilot Chat can execute Deepnote blocks on the notebook's live kernel and read the results.

Rescoped from the original proposal

The original proposal listed four tools: ListNotebooks, ReadNotebook, EditNotebook, RunBlocks. Three of them are now covered without extension code:

  • List, read and edit are provided by @deepnote/mcp and the Deepnote agent skill, which the extension installs and keeps up to date on every server start (feat(agent-skills): install and update Deepnote agent skills on server start #332). Both operate on the .deepnote file directly, so they work for any agent, not only ones with VS Code Language Model Tool access.
  • The extension already registers four tools in src/standalone/chat: configure_deepnote_notebook, deepnote_notebook_list_packages, deepnote_notebook_install_packages, restart_deepnote_notebook_kernel.

Execution is the one thing an external process cannot do. The MCP deepnote_run tool starts its own server and kernel, so it does not see the variables, DataFrames or installed packages of the kernel the user is working in. Only the extension can run a block in place and return the output.

Proposal

Contribute deepnote_run_blocks via languageModelTools:

// Input
{ "notebookUri": "file:///project/analysis.deepnote", "blockIds": ["abc2", "abc3"] } // omit blockIds to run all

// Output
[
  { "blockId": "abc2", "status": "success", "stdout": "", "richOutput": "DataFrame: 150 rows x 5 columns" },
  { "blockId": "abc3", "status": "error", "error": "OperationalError: relation \"users\" does not exist" }
]
  • Runs on the notebook's current kernel controller, starting it if needed.
  • Returns stdout, stderr, error text, and a text summary of rich outputs (DataFrame shape, chart type).
  • Requires the notebook to be a deepnote notebook type.

Sequencing

Blocked on #376, which replaces the kernel start and dependency layer this tool would sit on. Implement once that lands.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions