-
-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Description
Problem
When updating a notebook cell, the LLM often needs to read the current cell content before making changes. However, if the cell has already been executed and contains large outputs—such as long text logs, tables, or embedded images—this output is included in the cell’s content. As a result, the LLM’s context window can quickly become saturated with irrelevant output data, reducing available space for meaningful reasoning or edits. Currently, there is no tool to clear a cell’s output before reading it, nor a way to read a cell’s source without its output.
Proposed Solution
- Enhance the read_cell MCP tool to accept an optional parameter (e.g., include_output: bool = True) so LLM can request only the source code/metadata of a cell without its output.
- Add a new tool, e.g., clear_cell_output, that removes the output of a specified cell (or all cells), enabling clean reads or reducing notebook size before LLM interaction.
These changes would allow LLM-driven agents to efficiently interact with notebooks by focusing only on relevant (executable) content and managing context length effectively.
Additional context
- Similar functionality exists in Jupyter frontends (e.g., “Cell → Clear Output” in JupyterLab)
- Jupyter’s internal model already distinguishes between source and outputs in cell objects, so this separation is natively supported.
Metadata
Metadata
Assignees
Labels
No labels