MCPcopy Index your code
hub / github.com/deepnote/deepnote / findBlock

Function findBlock

packages/mcp/src/tools/writing.ts:17–23  ·  view source on GitHub ↗

* Find a block by ID or ID prefix. Returns the block or undefined.

(blocks: DeepnoteBlock[], idOrPrefix: string)

Source from the content-addressed store, hash-verified

15 * Find a block by ID or ID prefix. Returns the block or undefined.
16 */
17function findBlock(blocks: DeepnoteBlock[], idOrPrefix: string): DeepnoteBlock | undefined {
18 const matches = blocks.filter(b => b.id === idOrPrefix || b.id.startsWith(idOrPrefix))
19 if (matches.length > 1) {
20 throw new Error(`Ambiguous block ID prefix "${idOrPrefix}" matches multiple blocks`)
21 }
22 return matches[0]
23}
24
25/**
26 * Find a block index by ID or ID prefix. Returns -1 if not found.

Callers 1

handleEditBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected