modelcontextprotocol / modelcontextprotocol/servers

Add depth parameter to directory_tree function in filesystem server

Open
#1,077 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement server-filesystem
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Hi,

I’d like to suggest adding a depth parameter to the directory_tree function in the filesystem server.

I’m currently building an AI agent that utilizes the MCP server. When I call directory_tree to list files in a system repository, the returned file structure is too large, making it difficult to include in prompts due to token limitations. A depth limit would help return a more concise, manageable view of the directory structure.

Thanks for considering this enhancement!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the directory_tree function in the filesystem server and read how it currently traverses and returns the repository structure. Determine how a depth parameter should limit the returned tree, then verify that calls with and without the parameter produce appropriately sized results. The issue does not name a file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.