Notebooks

read_notebook

Read a notebook and return index, source content, type, execution count of each cell.

Read a notebook and return index, source content, type, execution count of each cell.

Using brief format to get a quick overview of the notebook structure and it's useful for locating specific cells for operations like delete or insert. Using detailed format to get detailed information of the notebook and it's useful for debugging and analysis.

It is recommended to use brief format with larger limit to get a overview of the notebook structure, then use detailed format with exact index and limit to get the detailed information of some specific cells.

read-only: yes

Parameters

ParameterTypeRequiredDefaultDescription
notebook_namestringyesNotebook identifier to read
response_formatbrief · detailedno"brief"Response format: 'brief' will return first line and lines number, 'detailed' will return full cell source
start_indexintegerno0Starting index for pagination (0-based)
limitintegerno20Maximum number of items to return (0 means no limit)

Output

{
  "properties": {
    "result": {
      "description": "Notebook content in the requested format",
      "title": "Result",
      "type": "string"
    }
  },
  "required": [
    "result"
  ],
  "title": "read_notebookOutput",
  "type": "object"
}

Call it

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "read_notebook",
    "arguments": {
      "notebook_name": "<notebook_name>",
      "response_format": "brief",
      "start_index": 0,
      "limit": 20
    }
  }
}
result = await session.call_tool("read_notebook", arguments={"notebook_name": "<notebook_name>", "response_format": "brief", "start_index": 0, "limit": 20})

Source

Registered by the @mcp.tool decorator on read_notebook in jupyter_mcp_server/server.py.