You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(mcp): add list_tree tool
This tool allows an agent to list files and directories from a
repository path. This can be used as a simple directory listing tool or
for a directory tree tool by specifying a depth > 1
* add PR link to mcp CHANGELOG.md
* chore(docs): markdown alignment
* improved error message for when repo is not found
---------
Co-authored-by: bkellam <bshizzle1234@gmail.com>
Copy file name to clipboardExpand all lines: packages/mcp/CHANGELOG.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
- Added `list_tree` tool for listing files/directories in a repository path with depth controls, suitable for both directory listings and repo-tree workflows. [#870](https://github.com/sourcebot-dev/sourcebot/pull/870)
12
+
10
13
## [1.0.15] - 2026-02-02
11
14
12
15
### Added
@@ -94,4 +97,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
// Skip entries filtered out by caller preferences
340
+
// (`includeFiles` / `includeDirectories`).
341
+
continue;
342
+
}
343
+
344
+
constkey=`${child.type}:${childPath}`;
345
+
if(seenEntries.has(key)){
346
+
// Skip duplicates when multiple requested paths overlap and
347
+
// surface the same child entry.
348
+
continue;
349
+
}
350
+
seenEntries.add(key);
351
+
352
+
// Stop collecting once the entry budget is exhausted.
353
+
if(entries.length>=normalizedMaxEntries){
354
+
truncated=true;
355
+
break;
356
+
}
357
+
358
+
entries.push({
359
+
type: child.type,
360
+
path: childPath,
361
+
name: child.name,
362
+
parentPath: currentPath,
363
+
depth: childDepth,
364
+
});
365
+
}
366
+
367
+
if(truncated){
368
+
break;
369
+
}
370
+
}
371
+
}
372
+
373
+
constsortedEntries=sortTreeEntries(entries);
374
+
375
+
return{
376
+
content: [{
377
+
type: "text",
378
+
text: JSON.stringify({
379
+
repo,
380
+
ref,
381
+
path: normalizedPath,
382
+
entries: sortedEntries,
383
+
totalReturned: sortedEntries.length,
384
+
truncated,
385
+
}),
386
+
}]
387
+
};
388
+
}
389
+
);
390
+
241
391
server.tool(
242
392
"list_language_models",
243
393
dedent`Lists the available language models configured on the Sourcebot instance. Use this to discover which models can be specified when calling ask_codebase.`,
0 commit comments