Skip to content

Register Language Model Tools for AI agent support #318

@Artmann

Description

@Artmann

AI agents in VS Code don't understand that .deepnote files are notebooks. They can't browse, read, edit, or execute blocks the way they can with .ipynb files. We want agents to be first-class citizens when working with Deepnote notebooks.

Proposal

Register four Language Model Tools via the VS Code languageModelTools contribution point.

ListNotebooks

Returns a list of all .deepnote files in the workspace with their paths and notebook names.

// Input
{ }

// Output
[
  { "uri": "file:///project/analysis.deepnote", "name": "analysis" },
  { "uri": "file:///project/etl/pipeline.deepnote", "name": "pipeline" }
]

ReadNotebook

Returns the structure and content of a notebook — block IDs, types, source content, and a summary of any existing outputs.

// Input
{ "notebookUri": "file:///project/analysis.deepnote" }

// Output
{
  "blocks": [
    { "id": "abc1", "type": "markdown", "content": "# Analysis" },
    { "id": "abc2", "type": "code", "language": "python", "content": "import pandas as pd\ndf = pd.read_csv('data.csv')" },
    { "id": "abc3", "type": "sql", "content": "SELECT * FROM users", "variable": "df_users" }
  ]
}

EditNotebook

Adds, updates, or removes blocks in a notebook.

// Input
{
  "notebookUri": "file:///project/analysis.deepnote",
  "edits": [
    { "kind": "add", "blockType": "code", "content": "df.describe()", "afterBlockId": "abc2" },
    { "kind": "update", "blockId": "abc3", "content": "SELECT * FROM users WHERE active = true" },
    { "kind": "remove", "blockId": "abc1" }
  ]
}

RunBlocks

Executes one or more blocks and returns the outputs (stdout, stderr, errors, and a summary of rich outputs like DataFrames and charts).

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

// Output
[
  { "blockId": "abc2", "status": "success", "stdout": "", "richOutput": "DataFrame: 150 rows × 5 columns" },
  { "blockId": "abc3", "status": "error", "error": "OperationalError: relation \"users\" does not exist" }
]

Registration

// package.json
{
  "contributes": {
    "languageModelTools": [
      {
        "name": "deepnote_listNotebooks",
        "displayName": "List Deepnote Notebooks",
        "modelDescription": "List all Deepnote notebooks (.deepnote files) in the workspace.",
        "tags": ["deepnote", "notebook"]
      },
      {
        "name": "deepnote_readNotebook",
        "displayName": "Read Deepnote Notebook",
        "modelDescription": "Read the structure and contents of a Deepnote notebook, returning all blocks with their IDs, types, and source content.",
        "tags": ["deepnote", "notebook"],
        "when": "resourceExtname == .deepnote"
      },
      {
        "name": "deepnote_editNotebook",
        "displayName": "Edit Deepnote Notebook",
        "modelDescription": "Edit a Deepnote notebook by adding, updating, or removing blocks.",
        "tags": ["deepnote", "notebook"],
        "when": "resourceExtname == .deepnote"
      },
      {
        "name": "deepnote_runBlocks",
        "displayName": "Run Deepnote Blocks",
        "modelDescription": "Execute blocks in a Deepnote notebook and return outputs including text, errors, and DataFrames.",
        "tags": ["deepnote", "notebook"],
        "when": "resourceExtname == .deepnote"
      }
    ]
  }
}

Cross-editor support

These tools use the VS Code languageModelTools API which works with Copilot but not in Cursor or Windsurf. For cross-editor support we should also expose the same capabilities via an MCP server (tracked separately).

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