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

Function findDeepnoteFiles

packages/mcp/src/resources.ts:27–52  ·  view source on GitHub ↗

* List all .deepnote files in a directory recursively

(dir: string, maxDepth = 3, currentDepth = 0)

Source from the content-addressed store, hash-verified

25 * List all .deepnote files in a directory recursively
26 */
27async function findDeepnoteFiles(dir: string, maxDepth = 3, currentDepth = 0): Promise<string[]> {
28 if (currentDepth >= maxDepth) return []
29
30 const files: string[] = []
31
32 try {
33 const entries = await fs.readdir(dir, { withFileTypes: true })
34
35 for (const entry of entries) {
36 const fullPath = path.join(dir, entry.name)
37
38 if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules') {
39 const subFiles = await findDeepnoteFiles(fullPath, maxDepth, currentDepth + 1)
40 files.push(...subFiles)
41 } else if (entry.isFile() && entry.name.endsWith(DEEPNOTE_EXTENSION)) {
42 files.push(fullPath)
43 }
44 }
45 } catch (error) {
46 // Directory not accessible, skip but log for debugging
47 // biome-ignore lint/suspicious/noConsole: Intentional debug logging to stderr
48 console.error(`[deepnote-mcp] Could not scan directory ${dir}:`, error instanceof Error ? error.message : error)
49 }
50
51 return files
52}
53
54/**
55 * Parse a deepnote:// URI and extract the path

Callers 2

listResourcesFunction · 0.70
readResourceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected