Skip to main content
Glama
azharlabs
by azharlabs

move_cell

Reposition cells within Jupyter notebooks by specifying source and destination indices to reorganize content structure.

Instructions

Move a cell from one position to another

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
notebook_pathYesAbsolute path to the Jupyter notebook file
from_indexYesCurrent index of the cell
to_indexYesTarget index for the cell

Implementation Reference

  • The main handler function for the 'move_cell' tool. It reads the Jupyter notebook JSON, validates indices, moves the cell by splicing the cells array, writes the updated notebook back to disk, and returns a success message.
    async moveCell(notebookPath, fromIndex, toIndex) {
      const notebook = await this.readNotebook(notebookPath);
      this.validateCellIndex(notebook.cells, fromIndex);
      
      if (toIndex < 0 || toIndex >= notebook.cells.length) {
        throw new Error(`Invalid target index ${toIndex}. Must be between 0 and ${notebook.cells.length - 1}`);
      }
      
      const [movedCell] = notebook.cells.splice(fromIndex, 1);
      notebook.cells.splice(toIndex, 0, movedCell);
      await this.writeNotebook(notebookPath, notebook);
      
      return {
        content: [
          {
            type: "text",
            text: `Successfully moved cell from index ${fromIndex} to ${toIndex}`
          }
        ]
      };
    }
  • JSON Schema defining the input parameters for the 'move_cell' tool: notebook_path (string), from_index (integer), to_index (integer). Returned by the ListTools handler.
    {
      name: "move_cell",
      description: "Move a cell from one position to another",
      inputSchema: {
        type: "object",
        properties: {
          notebook_path: {
            type: "string",
            description: "Absolute path to the Jupyter notebook file"
          },
          from_index: {
            type: "integer",
            description: "Current index of the cell"
          },
          to_index: {
            type: "integer",
            description: "Target index for the cell"
          }
        },
        required: ["notebook_path", "from_index", "to_index"]
      }
    },
  • src/index.js:355-360 (registration)
    Tool call dispatching/registration in the CallToolRequestSchema handler's switch statement, which routes 'move_cell' calls to JupyterHandler.prototype.moveCell.
    case "move_cell":
      return await this.jupyterHandler.moveCell(
        args.notebook_path,
        args.from_index,
        args.to_index
      );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Move a cell') but does not cover critical aspects such as whether this modifies the notebook file permanently, requires specific permissions, handles errors (e.g., invalid indices), or has side effects like affecting other cells. This leaves significant gaps for a mutation tool.

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 a single, direct sentence with no wasted words, efficiently conveying the core action. It is front-loaded and appropriately sized for the tool's complexity, making it easy to parse quickly.

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?

Given the tool involves mutation (moving cells in a notebook) with no annotations and no output schema, the description is incomplete. It does not address behavioral traits like file modification, error handling, or return values, which are crucial for safe and effective use. The high schema coverage helps with parameters but does not fill these contextual 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?

The input schema has 100% description coverage, clearly documenting all three parameters. The description adds no additional meaning beyond the schema, such as explaining index ranges or interactions between parameters. Since schema coverage is high, the baseline score of 3 is appropriate as the description does not compensate but also does not detract.

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 ('Move') and resource ('a cell'), specifying the operation involves changing positions. It distinguishes from siblings like 'add_cell' or 'delete_cell' by focusing on relocation, but does not explicitly differentiate from similar tools like 'bulk_edit_cells' or 'edit_cell' in terms of scope.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it does not mention if this is for single-cell moves versus bulk operations (compared to 'bulk_edit_cells') or if it should be used over 'edit_cell' for positional changes. The description lacks context on prerequisites or exclusions.

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