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

Function computeStructure

packages/mcp/src/tools/reading.ts:17–41  ·  view source on GitHub ↗
(file: DeepnoteFile)

Source from the content-addressed store, hash-verified

15// --- Internal analysis helpers used by handleRead and individual handlers ---
16
17function computeStructure(file: DeepnoteFile) {
18 const blockCounts: Record<string, number> = {}
19 let totalBlocks = 0
20
21 for (const notebook of file.project.notebooks) {
22 for (const block of notebook.blocks) {
23 blockCounts[block.type] = (blockCounts[block.type] || 0) + 1
24 totalBlocks++
25 }
26 }
27
28 return {
29 projectName: file.project.name,
30 projectId: file.project.id,
31 notebooks: file.project.notebooks.map(n => ({
32 name: n.name,
33 id: n.id,
34 blockCount: n.blocks.length,
35 isModule: n.isModule || false,
36 })),
37 totalBlocks,
38 blockCounts,
39 hasIntegrations: (file.project.integrations?.length || 0) > 0,
40 }
41}
42
43function computeStats(file: DeepnoteFile) {
44 // Use CLI's analysis function for consistency

Callers 1

handleReadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected