@@ -3,6 +3,7 @@ import { isServiceError } from "@/lib/utils";
33import { getTree } from "@/features/git" ;
44import { buildTreeNodeIndex , joinTreePath , normalizeTreePath , sortTreeEntries } from "@/features/mcp/utils" ;
55import { ToolDefinition } from "./types" ;
6+ import { logger } from "./logger" ;
67import description from "./listTree.txt" ;
78
89const DEFAULT_TREE_DEPTH = 1 ;
@@ -41,7 +42,8 @@ export const listTreeDefinition: ToolDefinition<'list_tree', typeof listTreeShap
4142 name : 'list_tree' ,
4243 description,
4344 inputSchema : z . object ( listTreeShape ) ,
44- execute : async ( { repo, path = '' , ref = 'HEAD' , depth = DEFAULT_TREE_DEPTH , includeFiles = true , includeDirectories = true , maxEntries = DEFAULT_MAX_TREE_ENTRIES } ) => {
45+ execute : async ( { repo, path = '' , ref = 'HEAD' , depth = DEFAULT_TREE_DEPTH , includeFiles = true , includeDirectories = true , maxEntries = DEFAULT_MAX_TREE_ENTRIES } , context ) => {
46+ logger . debug ( 'list_tree' , { repo, path, ref, depth, includeFiles, includeDirectories, maxEntries } ) ;
4547 const normalizedPath = normalizeTreePath ( path ) ;
4648 const normalizedDepth = Math . min ( depth , MAX_TREE_DEPTH ) ;
4749 const normalizedMaxEntries = Math . min ( maxEntries , MAX_MAX_TREE_ENTRIES ) ;
@@ -74,7 +76,7 @@ export const listTreeDefinition: ToolDefinition<'list_tree', typeof listTreeShap
7476 repoName : repo ,
7577 revisionName : ref ,
7678 paths : currentLevelPaths . filter ( Boolean ) ,
77- } ) ;
79+ } , { source : context . source } ) ;
7880
7981 if ( isServiceError ( treeResult ) ) {
8082 throw new Error ( treeResult . message ) ;
0 commit comments