Skip to main content
Glama

Search Files

search_files
Read-onlyIdempotent

Search file contents using regular expressions to find definitions or mentions anywhere in a directory. Supports glob filters and context lines for precise results.

Instructions

Search file contents under a directory with a regular expression (like grep -rn, but no shell quoting to get wrong). Skips binary files, .git and node_modules. Use this to find where something is defined or mentioned.

Args:

  • path (string): Directory (or single file) to search.

  • pattern (string): Regular expression, e.g. "function \w+Tools". Plain text works too.

  • glob (string): Optional filename filter, e.g. ".ts" or "src/**/.js".

  • context_lines (number): Lines of context around each match (default 0).

  • max_results (number): Max matching lines returned (default 50).

Returns matches as file:line: text, grouped by file.

Example: { "path": "~/project", "pattern": "registerTool", "glob": "*.ts" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesDirectory or file to search
patternYesRegular expression to find
globNoOptional filename glob filter
context_linesNoContext lines around matches
max_resultsNoMax matching lines
Behavior4/5

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

Annotations declare readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description adds behavioral details like skipping binary files, .git, node_modules, and grouping results by file. This provides context beyond the annotations without contradiction.

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 three sentences plus an example, no unnecessary words. It front-loads the purpose and then provides details. Every sentence earns its place.

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 no output schema, the description explains the return format (file:line: text, grouped by file). It covers all essential aspects for a search tool: scanning behavior, skipped paths, parameter explanations, and example usage. Complete for its complexity.

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 description coverage is 100%, but the description adds value: e.g., for pattern, it says 'Plain text works too' and provides an example. It also explains the return format, which is not in the schema. This enriches understanding beyond the schema.

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 states it searches file contents with a regular expression like grep -rn, and explicitly mentions skipping binary files, .git, and node_modules. This clearly distinguishes it from sibling tools like find_files (which finds by filename) and read_file (which reads a single file).

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?

The description says 'Use this to find where something is defined or mentioned,' providing clear when-to-use guidance. It does not explicitly state when not to use or name alternatives, but the context is sufficient for an intelligent agent to decide.

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/highercomve/mcptools'

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