Skip to main content
Glama

list_all_files_in_project

Generate a file tree of all files in a project or specific subdirectories. Use depth limits and filters to efficiently inspect project structure and navigate large codebases.

Instructions

List all files in a project, returning a file tree.

This is useful for getting an overview of the project, or specific subdirectories of the project.

A project may have many files, so you are suggested to start with a depth limit to get an overview, and then continue increasing the depth limit with a filter to look at specific subdirectories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limit_depth_from_rootNoLimit the depth of the search to this many directories from the root. Typically,start with 1 to get an overview of the project.If None, search all directories from the root.
path_filterNoMatch if any of these strings appear. Match all if None/null. Single empty string or empty list will match all.
project_nameYes

Implementation Reference

  • The handler function for the 'list_all_files_in_project' tool. It is decorated with @mcp.tool() for registration and implements the core logic: retrieves the project, creates a file tree using create_file_tree with optional filters and depth limit, and returns the formatted response.
    @mcp.tool()
    @log_inputs_outputs()
    def list_all_files_in_project(
        project_name: str,
        path_filter: FilterType = None,
        limit_depth_from_root: Annotated[
            int | None,
            Field(
                description=(
                    "Limit the depth of the search to this many directories from the root. "
                    "Typically,start with 1 to get an overview of the project."
                    "If None, search all directories from the root."
                ),
            ),
        ] = None,
    ) -> ToolResponse:
        """List all files in a project, returning a file tree.
    
        This is useful for getting an overview of the project, or specific
        subdirectories of the project.
    
        A project may have many files, so you are suggested
        to start with a depth limit to get an overview, and then continue increasing
        the depth limit with a filter to look at specific subdirectories.
        """
        project = _get_project_or_error(project_name)
        data = create_file_tree(
            project_root=project.root,
            paths={x.abs_path for x in project.chunk_project.files},
            limit_depth_from_root=limit_depth_from_root,
            filter_=path_filter,
        )
        if data is None:
            return MCPToolOutput(text="No paths").render()
        elif isinstance(data, str):
            return MCPToolOutput(text=data).render()
        else:
            assert_never(data)
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jurasofish/mcpunk'

If you have feedback or need assistance with the MCP directory API, please join our Discord server