Skip to main content
Glama

list_cells

Retrieve all cells from a Jupyter notebook with their indices and types to inspect notebook structure and content organization.

Instructions

List all cells in a Jupyter notebook with their indices and types

Input Schema

NameRequiredDescriptionDefault
notebook_pathYesAbsolute path to the Jupyter notebook file

Input Schema (JSON Schema)

{ "properties": { "notebook_path": { "description": "Absolute path to the Jupyter notebook file", "type": "string" } }, "required": [ "notebook_path" ], "type": "object" }

Implementation Reference

  • The main handler function that executes the list_cells tool. It reads the Jupyter notebook file, extracts cell information (index, type, preview of source), formats it into a text response, and returns it.
    async listCells(notebookPath) { const notebook = await this.readNotebook(notebookPath); const cellsInfo = notebook.cells.map((cell, index) => { const source = Array.isArray(cell.source) ? cell.source.join('') : cell.source; const preview = source.length > 100 ? source.substring(0, 100) + '...' : source; return { index, type: cell.cell_type, preview: preview.replace(/\\n/g, ' ') }; }); return { content: [ { type: "text", text: `Notebook: ${notebookPath}\nTotal cells: ${cellsInfo.length}\n\n${ cellsInfo.map(cell => `[${cell.index}] ${cell.type}: ${cell.preview}` ).join('\n') }` } ] }; }
  • The input schema definition for the list_cells tool, specifying the required notebook_path parameter.
    name: "list_cells", description: "List all cells in a Jupyter notebook with their indices and types", inputSchema: { type: "object", properties: { notebook_path: { type: "string", description: "Absolute path to the Jupyter notebook file" } }, required: ["notebook_path"] } },
  • src/index.js:331-333 (registration)
    The registration/dispatch point in the main CallToolRequestSchema handler where calls to list_cells are routed to the JupyterHandler's listCells method.
    case "list_cells": return await this.jupyterHandler.listCells(args.notebook_path);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/azharlabs/mcp-jupyter-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server