Skip to content

fix(filesystem): improve search_files description and performance #3419

Closed

Description

@olaservo

Summary

The search_files tool description is ambiguous — LLMs frequently confuse it with a content search (grep) when it's actually a name-based file finder. This causes failed searches and poor user experience.

Originally raised in issues #896, #735, #1067, and extensively explored in PR #897 by @sebastien-rosset.

Proposed Changes

Based on the work in PR #897, adapted for the current registerTool() architecture:

  1. Improve search_files tool description to clearly state it searches by file/directory name, not file contents. Clarify that it supports glob patterns and substring matching.

  2. Improve search performance with parallel BFS directory traversal (breadth-first, processing directories in batches) instead of recursive DFS, for better performance in deeply nested directory trees.

  3. Add comprehensive test coverage for the search function, including:

    • Glob pattern matching
    • Case sensitivity behavior
    • Exclude patterns
    • Directory traversal
    • Error handling for inaccessible directories

Context

PR #897 implemented these improvements thoroughly but is now stale (merge conflicts after the Nov 2025 architecture refactoring). The valuable ideas and approach should be carried forward in a fresh PR targeting the current codebase (searchFilesByName in lib.ts, registerTool() in index.ts).

Credit: @sebastien-rosset for the original research, implementation, and LLM testing that validated these improvements.

Related

Activity

  1. self-assigned this
    on Feb 27, 2026
  2. alanbork commented on Mar 23, 2026

    @alanbork

    I fully agree. This bites me so often I wrote my own custom MCP to provide the much-need substring search functionality (find-all-in-files).

  3. added
    enhancementNew feature or request
    server-filesystemReference implementation for the Filesystem MCP server - src/filesystem
    on Oct 19, 2026
  4. cliffhall commented on Oct 19, 2026

    @cliffhall
    Member

    Triage: Priority Low (total 5)

    • Severity 2: Clarifying that search_files matches file and directory names rather than contents is a worthwhile usability fix that consolidates several earlier reports.
    • Urgency 2: wanted eventually
    • Bonuses: +1 assigned

    Board: Servers V2 (#43), Status Incoming, awaiting maintainer review (no milestone yet). Part of the backlog triage in #4875.

  5. added this to the v2.3.0 milestone on Oct 25, 2026
  6. self-assigned this
    on Oct 28, 2026
  7. cliffhall commented on Oct 29, 2026

    @cliffhall
    Member

    Shipped in #5367, merged into v2/main; it releases with milestone v2.3.0. Tested together with the rest of the #5269 work in the rollup #5405.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or requestserver-filesystemReference implementation for the Filesystem MCP server - src/filesystemv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions