Skip to content

Commit 834ead9

Browse files
authored
fix(list_directory): include listing in structuredContent (#496)
list_directory put the [DIR]/[FILE] listing only in the text content array; its structuredContent carried just { fileName, filePath, fileType: 'directory' } with no entries. Clients that render from the text content (chat file-preview widget) worked, but structuredContent- only consumers (e.g. Cowork) received an empty directory object and rendered "directory empty". Bring list_directory in line with the read_file structuredContent convention by adding `sourceTool: 'list_directory'` and `content` (the listing text). Chat is unaffected — it still reads the same text from the content array — while structuredContent consumers now get the listing. No change to the model-facing content array.
1 parent f5ba5a4 commit 834ead9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/handlers/filesystem-handlers.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ export async function handleListDirectory(args: unknown): Promise<ServerResult>
361361
fileName: path.basename(resolvedPath),
362362
filePath: resolvedPath,
363363
fileType: 'directory' as const,
364+
sourceTool: 'list_directory',
365+
// Carry the listing in structuredContent too. Chat reads the text
366+
// content array, but structuredContent-only consumers (e.g. Cowork)
367+
// render from here and would otherwise show an empty directory.
368+
content: resultText,
364369
},
365370
};
366371
} catch (error) {

0 commit comments

Comments
 (0)