Skip to main content
Glama

Search Content

grep
Read-onlyIdempotent

Search file contents for text or regex patterns, returning matching lines. Scope with file globs, control case sensitivity, whole word matching, and include context lines. Optionally include hidden or ignored files.

Instructions

Search file contents for text (grep-like). Returns matching lines. Scope with filePattern (e.g. **/*.ts) to reduce noise. includeHidden=true for dotfiles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoBase directory (default: root). Absolute path required if multiple roots.
patternYesSearch text. RE2 regex when `isRegex=true`.
isRegexNoTreat pattern as RE2 regex (no lookahead/lookbehind/backrefs).
caseSensitiveNoCase-sensitive matching. Default: case-insensitive.
wholeWordNoMatch whole words only
contextLinesNoInclude N lines of context before/after matches
maxResultsNoMaximum match rows to return. Default: 500
filePatternNoGlob for candidate files (e.g. "**/*.ts")**/*
includeHiddenNoInclude hidden items (starting with .)
includeIgnoredNoInclude ignored items (node_modules, etc).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
totalMatchesNoTotal matches found
truncatedNoResults truncated?
resourceUriNoFull results URI
okYes
matchesNo
filesScannedNoFiles scanned
filesMatchedNoFiles with matches
skippedTooLargeNoFiles skipped: too large
skippedBinaryNoFiles skipped: binary
skippedInaccessibleNoFiles skipped: inaccessible
stoppedReasonNoWhy search stopped
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive. Description adds that it returns matching lines and mentions key parameters, but does not reveal additional behavioral traits beyond that.

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?

Two concise sentences with no fluff. Front-loaded with the primary action and key scoping options.

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?

Given 10 parameters and an output schema, the description covers core functionality but does not mention response limits (maxResults) or output format, though the schema covers details.

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% with good descriptions. The description reinforces the most important parameters (pattern, filePattern, includeHidden) but adds minimal new information.

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?

Clearly states it searches file contents for text, grep-like, returning matching lines. Distinguishes from siblings like 'find' (searches filenames) and 'read' (reads file content).

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 tips on scoping with filePattern and includeHidden for dotfiles. Does not explicitly mention when not to use or compare to alternatives, but the sibling list implies context.

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/j0hanz/filesystem-mcp'

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