Skip to main content
Glama

search_content

Search file contents with surrounding context to find implementations, trace calls, or analyze patterns. Supports regex, .gitignore, and binary skip.

Instructions

USE INSTEAD OF GREP. Search file contents with surrounding context - see matches in context without follow-up reads.

Respects .gitignore, skips binary files, smart case-sensitivity. Use for finding implementations, tracing function calls, or analyzing patterns across a codebase.

Use context_lines parameter to control how much surrounding code you see (default: 2 lines).

Examples: "slackSend|notification" in *.groovy, "webhook" across all files, "TODO" in src/

Requires ripgrep: brew install ripgrep (macOS) | apt install ripgrep (Ubuntu)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reasoningYesExplain why you are using this tool - helps track search patterns and improve results
queryYesText or regex pattern to search for inside files, e.g. "TODO", "function.*export", "apiKey"
pathNoDirectory to search in. Defaults to current working directory
file_patternNoOnly search in files matching this pattern, e.g. "*.ts", "*.{js,jsx}"
include_hiddenNoInclude hidden files and directories (dotfiles). Default: true
ignore_gitignoreNoRespect .gitignore rules and skip ignored files. Default: true
excludeNoAdditional patterns to exclude, e.g. ["node_modules", "dist", "*.log"]
detail_levelNoHow much info to return: "minimal" (paths only), "standard" (+ size/date), "full" (+ content preview)standard
context_linesNoNumber of lines to show before and after each match. Default: 2
Behavior4/5

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

Without annotations, the description effectively discloses key behaviors: respects .gitignore, skips binary files, smart case-sensitivity, and requires ripgrep. It also explains the context_lines parameter's effect. It could mention limitations or performance considerations for a 5.

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?

The description is front-loaded with purpose and is fairly concise. The inclusion of install commands and examples is helpful but could be slightly trimmed for conciseness. Overall, it is well-structured and not verbose.

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?

Given the tool has 9 parameters and no output schema, the description covers core usage but doesn't explain all parameters (e.g., detail_level) or the exact return format. It provides enough for basic use but lacks completeness for advanced scenarios.

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 baseline 3 is appropriate. The description adds value through query examples and context_lines default, but does not explain parameters like detail_level or exclude beyond the schema descriptions.

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 it is a tool for searching file contents with surrounding context, explicitly positioning it as an alternative to grep. The verb 'search' and resource 'file contents' are specific, and the description distinguishes it from siblings like fuzzy_find and search_files by focusing on content search with context lines.

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 explicitly says 'USE INSTEAD OF GREP' and provides specific use cases (finding implementations, tracing function calls). However, it does not contrast with sibling tools (fuzzy_find, search_files, tree) or provide explicit when-not-to-use conditions, which would make it a 5.

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/elad12390/file-search-mcp'

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