Skip to main content
Glama

grep_files

Search file contents using regular expressions, returning matching lines with context. Configure case sensitivity, file types, and output modes.

Instructions

Search text patterns within file contents using regex. Returns matching line numbers and context - use with read_file/read_multiple_files to retrieve actual content. Supports: regex patterns, case-insensitive (-i), context lines (-A/-B/-C), file type filters (type: js/py/ts/etc), glob patterns, multiline mode. Output modes: content (lines+context), files_with_matches (paths only), count (match counts). Respects ignored folders. Use head_limit to cap results. Only searches within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesRegex pattern to search for
pathNoDirectory/file to search (optional)
typeNoFile type filter: js, py, ts, etc
globNoGlob filter: *.js, **/*.test.ts
-iNoCase insensitive
-ANoLines after match
-BNoLines before match
-CNoLines before+after match
output_modeNocontent|files_with_matches|countcontent
head_limitNoLimit results to N
multilineNoAllow . to match newlines
Behavior4/5

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

The description reveals key behavioral traits: respects ignored folders, only searches allowed directories, supports various flags and output modes. Since no annotations exist, it carries full burden and does so well, though it could more explicitly state it is read-only (implied by 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?

The description is a single efficient paragraph that front-loads the core purpose, then lists capabilities, output modes, and constraints. Every sentence adds value without redundancy.

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 the tool's complexity (11 parameters, no output schema), the description is comprehensive: covers regex, flags, output modes, limitations (ignored folders, allowed directories), and mentions line numbers and context. No major gaps.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds value by explaining flags, output modes, and head_limit usage, including practical notes like 'use with read_file'.

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?

The description clearly states 'Search text patterns within file contents using regex', which is a specific verb+resource. It distinguishes from siblings like read_file and glob_files by focusing on pattern matching.

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?

It suggests using with read_file/read_multiple_files to retrieve actual content, providing context for complementary tools. However, it does not explicitly state when not to use grep_files or list specific alternatives beyond read_file.

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/n0zer0d4y/vulcan-file-ops'

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