Skip to content

directory_tree tool returns flat list instead of recursive tree structure with children #25

@amcharles91

Description

@amcharles91

The directory_tree tool's implementation doesn't match its documented behavior.

Expected behavior (per tool description):

  • Returns a recursive tree view of files and directories
  • Each directory entry includes a children array containing its nested items
  • Provides a hierarchical JSON structure

Actual behavior:

  • Returns only immediate children (non-recursive)
  • No children property in the output
  • Returns a flat array instead of a tree structure

Current output:
[
{"name": "file1.txt", "type": "file"},
{"name": "subdir", "type": "directory"}
]

Expected output:
[
{"name": "file1.txt", "type": "file"},
{
"name": "subdir",
"type": "directory",
"children": [
{"name": "nested.txt", "type": "file"},
{
"name": "deeper",
"type": "directory",
"children": []
}
]
}
]

This breaks compatibility with the original @modelcontextprotocol/server-filesystem that this project claims to reimplement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions