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

Function resolveBlockId

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

* Resolve a block ID or prefix to the full block ID. Returns undefined if not found.

(blocks: DeepnoteBlock[], idOrPrefix: string)

Source from the content-addressed store, hash-verified

39 * Resolve a block ID or prefix to the full block ID. Returns undefined if not found.
40 */
41function resolveBlockId(blocks: DeepnoteBlock[], idOrPrefix: string): string | undefined {
42 const matches = blocks.filter(block => block.id === idOrPrefix || block.id.startsWith(idOrPrefix))
43 if (matches.length > 1) {
44 throw new Error(`Ambiguous block ID prefix "${idOrPrefix}" matches multiple blocks`)
45 }
46 return matches[0]?.id
47}
48
49function writingError(message: string) {
50 return {

Callers 1

handleReorderBlocksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected