Skip to main content
Glama

Search files by name or content

search_files
Read-onlyIdempotent

Search files recursively by glob and optional content regex to locate matches under a directory; skips symlinks and caps returned results.

Instructions

Recursively search below a root for files matching a glob and optionally a regular expression in their contents. Symlinks are skipped. Returns up to max_results matches.

Input Schema

NameRequiredDescriptionDefault
globNoGlob for names or relative paths, e.g. "*.js" or "src/**/*.ts". Default "*".
rootNoDirectory to search. Default $HOME.
queryNoRegular expression to match in file contents.
max_depthNoDirectory depth limit. Default 12.
max_resultsNoDefault 100.
case_sensitiveNoCase-sensitive content matching. Default true.
include_hiddenNoInclude hidden files and directories. Default false.
max_file_bytesNoSkip content search in larger files. Default 1 MiB.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already establish readOnly/idempotent/non-destructive, so the bar is lower, and the description still adds real behavior: symlinks are skipped and results are capped at max_results. It stops short of saying how truncation is surfaced or how results are ordered, which matters for a capped search.

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

Conciseness5/5

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

Three compact sentences, no redundancy, and the core semantics are front-loaded before the secondary caveats (symlinks, result cap). Every sentence carries distinct information.

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 8 optional params, full schema coverage, and no output schema, the description covers the essential semantics an agent needs to select and call the tool. The remaining gap is the shape/ordering of returned matches, which a capped multi-mode search would ideally state.

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 every parameter including defaults is already documented in the schema, making 3 the baseline. The description only re-touches glob, query, and max_results in prose without adding format, precedence (glob vs. query), or interaction details beyond the schema.

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

Purpose4/5

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

Specific verb (recursively search) plus resource (files) and two matching modes (glob on names/paths, regex on contents), which is more precise than the title alone. It does not, however, explicitly distinguish itself from nearby siblings like list_dir or read_file, so the agent must infer the boundary.

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

Usage Guidelines3/5

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

The phrase 'optionally a regular expression in their contents' implies the two usage modes (name-only glob vs. content grep), which is useful implied guidance. There is no explicit statement of when to prefer this over list_dir/read_file, nor any exclusion or prerequisite, so usage remains inferred rather than stated.

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