Skip to main content
Glama

searchFiles

Search files in a directory for text or regex patterns, optionally filter by file type and recurse subdirectories, then return matches with surrounding context.

Instructions

Searches for text patterns within files in a directory using regular expressions. Returns matches with context.

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": {
      "query": "<query>",
      "path": "<path>"
    },
    "name": "searchFiles"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesDirectory to search
queryYesSearch pattern (text or regex)
fileTypesNoFilter by file extensions (e.g., ["txt", "md"])
recursiveNoSearch subdirectories (default: true)
maxResultsNoMaximum results to return (default: 50)
caseSensitiveNoCase-sensitive search (default: false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose the matching mechanism (regex) and the return shape at a high level ("matches with context"). It omits whether the operation is read-only/non-destructive, how invalid patterns are handled, and how binary or very large files are treated.

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 sentences, front-loaded with the action and scope, with no redundant or filler wording. Every phrase contributes either purpose or return information.

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

Completeness3/5

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

For a six-parameter, unannotated search tool with no output schema, the definition covers what it does and roughly what it returns, which is the minimum viable level. It leaves out behavioral context an agent would want before calling it, such as read-only safety and error/limit behavior.

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 path, query, fileTypes, recursive, maxResults, and caseSensitive are all documented in the schema with defaults. The description adds only the phrase "using regular expressions" to reinforce query semantics, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb and resource ("searches for text patterns within files in a directory") plus the mechanism (regular expressions). It is clearly distinguishable from readFile or saveToFile, but it never names a sibling or states the boundary with summarizeDirectory, so differentiation is inferred rather than declared.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use guidance: no statement about when to search versus reading a specific file, no mention of when recursive or fileTypes filtering should be applied, and no exclusions. The only usage signal is the implied "search a directory" scope.

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