Skip to main content
Glama

search_directory

Read-only

Search for text patterns across all files in a directory, with options for file filtering, context lines, and fuzzy or regex matching. Automatically ignores common non-source directories.

Instructions

Search for a text pattern across all files in a directory.

Returns results grouped by file with line numbers and context. Use
include_pattern to filter by file extension (e.g. '*.py'). Automatically
ignores __pycache__, node_modules, and .git. Prefer fuzzy=False (default)
for multi-file search performance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
absolute_dir_pathYesThe absolute path to the directory to search.
patternYesText pattern to search for.
include_patternNofnmatch glob matched against file names (default: '*'). Examples: '*.py', '*.md', '*.ts'.*
max_resultsNoTotal match cap across all files. Defaults to server config (100).
context_linesNoLines of context before/after each match (default: 2).
fuzzyNoEnable fuzzy matching (default: false, expensive for many files).
regexNoEnable Python regex matching (default: false).
case_sensitiveNoCase-sensitive search (default: false).
invertNoReturn non-matching lines, like grep -v (default: false).
include_hiddenNoInclude dot-files and dot-dirs (default: false).
Behavior4/5

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

Annotations (readOnlyHint=true) already disclose non-destructiveness. Description adds value by revealing automatic directory ignores (__pycache__, node_modules, .git) and performance implications of fuzzy matching. This goes beyond annotations without contradicting them.

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?

Four sentences, each with distinct value: purpose, return format, filtering/ignores, and performance tip. Front-loaded with core purpose. No redundancy or irrelevant details.

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

Completeness5/5

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

Given 10 parameters (2 required) with full schema coverage, the description sufficiently covers usage context. It explains return format (grouped by file with line numbers and context) and automatic ignores, which are not in schema. No output schema exists, but the description fills the gap.

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 baseline is 3. Description adds minimal parameter-specific info beyond the schema (e.g., include_pattern example, fuzzy performance note). These are helpful but not essential for understanding parameter meaning.

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?

Clear verb+resource scope: searches for a text pattern across all files in a directory. Distinguishes from sibling tools like search_content (likely single-file) and list_directory (listing vs searching). The description explicitly states the scope and output format.

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?

Provides clear usage guidance: recommends using include_pattern to filter extensions and defaults to fuzzy=False for performance. However, it does not explicitly tell when to prefer this tool over search_content or other alternatives, so it lacks explicit exclusions.

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

Install Server

Other 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/peteretelej/largefile'

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