Skip to main content
Glama
tmlksu

notebook-edit

by tmlksu

patch_cell

Replace a unique substring in a notebook cell by index or cell ID, returning the new revision for chaining edits.

Instructions

Preferred edit tool: replace a unique old substring with new in a cell.

Target the cell by index (0-based) OR cell_id (stable id from list_cells); pass exactly one. Prefer cell_id when chaining several patches — indices shift after inserts/deletes/moves, ids don't, so this avoids patching the wrong cell. old must occur exactly once in the cell; otherwise this errors and asks for more context. Keeps diffs small. Editing a code cell clears its outputs. Optionally pass expected_rev (from notebook_rev or a prior write) to refuse the write if the file changed on disk since. Returns the new rev, so chained patches can pass it forward without re-reading.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
newYes
oldYes
pathYes
indexNo
cell_idNo
expected_revNo
Behavior4/5

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

No annotations exist, so the description carries full burden. It discloses that editing a code cell clears its outputs, that old must occur exactly once (otherwise errors), and that the tool returns the new rev for chaining. This covers key behavioral traits.

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

Conciseness4/5

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

The description is moderately long but front-loaded with the core action. Each sentence adds distinct value (usage advice, error conditions, output). No wasted words, though it could be slightly tighter.

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

Completeness4/5

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

With 6 parameters and no output schema, the description covers purpose, parameter semantics, usage guidance, error behavior, and return value. It addresses chaining and concurrency. Could mention that path is required, but overall complete.

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

Parameters5/5

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

Schema coverage is 0%, but the description explains every parameter: index (0-based), cell_id (stable id), old (unique substring), new (replacement), expected_rev (optimistic concurrency). It clarifies that exactly one of index/cell_id must be passed, adding meaning beyond the schema.

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

Purpose5/5

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

The description starts with 'replace a unique old substring with new in a cell,' clearly stating the action and resource. It distinguishes from sibling tools like edit_cell and delete_cell by framing itself as a targeted substring replacement tool, not a full cell edit.

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

Usage Guidelines4/5

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

Provides explicit guidance: 'Preferred edit tool' for small diffs, advises preferring cell_id when chaining patches because indices shift, and describes error behavior when old occurs multiple times. Does not explicitly list when not to use (e.g., for full cell replacement), but the guidance is strong.

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/tmlksu/nbedit-mcp'

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