Skip to main content
Glama
azharlabs
by azharlabs

delete_cell

Remove a specific cell from a Jupyter notebook file by specifying its index to clean up or reorganize notebook content.

Instructions

Delete a cell by index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
notebook_pathYesAbsolute path to the Jupyter notebook file
cell_indexYesZero-based index of the cell to delete

Implementation Reference

  • The core handler function that reads the Jupyter notebook, validates the cell index, deletes the specified cell (preventing deletion of the last cell), persists the changes, and returns a success message.
    async deleteCell(notebookPath, cellIndex) {
      const notebook = await this.readNotebook(notebookPath);
      this.validateCellIndex(notebook.cells, cellIndex);
      
      if (notebook.cells.length === 1) {
        throw new Error("Cannot delete the last remaining cell in the notebook");
      }
      
      notebook.cells.splice(cellIndex, 1);
      await this.writeNotebook(notebookPath, notebook);
      
      return {
        content: [
          {
            type: "text",
            text: `Successfully deleted cell ${cellIndex}`
          }
        ]
      };
    }
  • The input schema definition for the delete_cell tool, specifying required parameters notebook_path (string) and cell_index (integer).
    {
      name: "delete_cell",
      description: "Delete a cell by index",
      inputSchema: {
        type: "object",
        properties: {
          notebook_path: {
            type: "string",
            description: "Absolute path to the Jupyter notebook file"
          },
          cell_index: {
            type: "integer",
            description: "Zero-based index of the cell to delete"
          }
        },
        required: ["notebook_path", "cell_index"]
      }
  • src/index.js:352-354 (registration)
    The dispatch registration in the MCP server's CallToolRequestSchema handler that routes delete_cell calls to the JupyterHandler's deleteCell method.
    case "delete_cell":
      return await this.jupyterHandler.deleteCell(args.notebook_path, args.cell_index);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Delete' implies a destructive mutation, the description doesn't specify whether this operation is reversible, what permissions are required, whether it affects notebook structure, or what happens to subsequent cell indices. This leaves significant behavioral gaps for a destructive operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just four words, front-loading the essential action and target. There's zero wasted language or redundancy, making it highly efficient for an agent to parse while still conveying the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address critical context like what 'delete' entails (permanent removal? moves to trash?), whether indices shift after deletion, what permissions are needed, or what the response contains. The combination of destructive operation with minimal description creates significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, both parameters are already documented in the input schema. The description adds no additional semantic context about the parameters beyond what the schema provides. The baseline score of 3 reflects adequate but minimal value addition from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and target resource ('a cell by index'), providing specific verb+resource pairing. However, it doesn't differentiate from sibling tools like 'bulk_edit_cells' or 'move_cell' which might also involve cell removal operations, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'bulk_edit_cells' (for multiple deletions), 'move_cell' (for repositioning instead of deletion), and 'edit_cell' (for modification rather than removal), there's no indication of when this specific deletion tool is preferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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