Skip to main content
Glama
agentic-search-mcp

agentic-search-mcp

grep

Search file contents using regular expressions or literal text, with optional glob filters, case-insensitive matching, and result limits to locate code patterns or TODO items.

Instructions

Search file contents with a regular expression (or a literal string).

pattern is a Python re regular expression matched against each line with re.search -- it is not a shell grep command. Use | to combine alternatives, .* for wildcards, and groups/quantifiers such as (foo|bar) or \w+. \| matches a literal pipe character, so do not escape | to mean "or" (GNU grep basic-regex syntax is not used). For example::

grep(pattern="def (load|save)_config|class .*Settings|TODO.*(refactor|migrate)", glob_filter="*.py")

Set literal=True to match plain text with no regex interpretation. Use ignore_case for case-insensitive matching and max_results to cap output; there is no shell pipeline to pipe into head.

Args: pattern: Regular expression (Python re syntax), or literal text when literal is true. Combine alternatives with unescaped |. path: File or directory to search (absolute or root-relative, default root). glob_filter: Optional filename filter, e.g. *.py. literal: Treat pattern as plain text instead of a regex (default false). ignore_case: Case-insensitive matching (default false). max_results: Cap on returned matches (default 100).

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": {
      "pattern": "<pattern>"
    },
    "name": "grep"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNo.
literalNo
patternYes
glob_filterNo
ignore_caseNo
max_resultsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does a good job: it discloses line-by-line matching, the no-shell-pipeline constraint, a default output cap of 100, and the default search root. It stops short of stating behavior for invalid regexes, binary files, or hidden/permission-denied files, which matters for a filesystem scanner.

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 core statement, then syntax guidance, an example, and an Args block. It is slightly long and mildly redundant — the "don't escape | for or" point appears twice — but every section serves a distinct purpose and the example is high-value.

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?

An output schema exists, so return-value explanation is correctly omitted, and all six parameters plus the regex dialect are covered. What remains is edge-case behavior (error on bad regex, binary/hidden file handling) that a content-search tool ideally discloses.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate, and it does: every one of the six parameters is explained with meaning beyond its title (pattern is a Python regex matched per line; path is absolute or root-relative; glob_filter is a filename filter; literal disables regex interpretation; ignore_case and max_results caps output). The worked example anchors the trickiest parameter.

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 and resource ("Search file contents") and immediately qualifies the mechanism (regular expression or literal string). This distinguishes it from the siblings glob (filename matching) and read (whole-file retrieval) without needing to open any schema.

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 detailed when-to-use guidance on the regex dialect: Python re.search per line, use | for alternatives, | is not to be escaped, no GNU basic-regex, set literal=True for plain text, use max_results instead of piping to head. It does not explicitly say "use glob instead when you only know the filename", so an explicit sibling exclusion is missing.

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

Deploy Server

Other Tools