Skip to main content
Glama

Search Files

search_files
Read-onlyIdempotent

Find files and directories by name using glob patterns under a specified path; matches paths only and returns full locations without reading file contents.

Instructions

Find files and directories by NAME, not by content: this tool never reads or searches inside files. It walks the tree under 'path' and matches a glob pattern against each entry's path relative to 'path' (case-sensitive). Use '.ext' to match entries directly under 'path', and '**/.ext' or '**/name' to match at any depth. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>",
      "pattern": "<pattern>"
    },
    "name": "search_files"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesThe directory to search under. Absolute, or relative to an allowed directory; it must resolve inside the allowed directories.
patternYesGlob matched against each entry's path relative to path, never its content: '*.ts' matches directly under path, '**/*.ts' at any depth.
excludePatternsNoPatterns for entries to leave out, with their contents, matched against each entry's path relative to path. A pattern with no '*' matches that name at any depth ('node_modules' leaves out every node_modules directory); a pattern with '*' is a glob matched as written, and one ending in '/**' also leaves out the directory it names.

Output Schema

NameRequiredDescriptionDefault
contentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly=true, idempotent=true, non-destructive, so the safety profile is covered. The description adds genuine behavioral detail beyond that: matching is case-sensitive, patterns are matched against paths relative to 'path', and searches are confined to allowed directories. With annotations carrying the safety profile, this is solid but not exceptional.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the key distinction (name vs content) before the mechanics, and each sentence covers a distinct point. Slight redundancy between the opening negation and the later 'Great for finding files...' sentence keeps it from a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema and 100% parameter coverage, the description only needs to supply matching semantics and constraints, which it does (relative-path matching, case sensitivity, allowed-directory restriction). Return-value behavior is correctly left to the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all three parameters including excludePatterns are fully documented structurally. The description restates pattern depth semantics already present in the schema ('*.ext' vs '**/*.ext') and adds only the case-sensitivity note, so it does not meaningfully exceed the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('Find files and directories by NAME') and immediately rules out the most likely confusion with a clear negation: 'not by content: this tool never reads or searches inside files.' That contrast separates it from read_file/read_text_file siblings without naming them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit use case ('Great for finding files when you don't know their exact location') and an explicit exclusion (no content search). It does not name a specific alternative for name-based listing (e.g., list_directory/directory_tree), so an agent must infer that boundary from sibling names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.