Skip to main content
Glama

grep_file

Search for text patterns in remote files over SSH. Specify a path and pattern to locate matches with line numbers and context.

Instructions

Search for a text pattern in remote files.

Args: path: File path or directory to search. pattern: Text or regex pattern to search for. recursive: Search recursively in directories (default False). ignore_case: Case-insensitive search (default True). context_lines: Lines of context around each match (default 2). host_name: Named host from SSH_HOSTS config; uses default host if omitted.

Returns: Matching lines with file names and line numbers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
patternYes
host_nameNo
recursiveNo
ignore_caseNo
context_linesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It adds return format ('Matching lines with file names and line numbers') and default behaviors (recursive=false, ignore_case=true, context_lines=2). However, it does not explicitly state that the operation is read-only or non-destructive, nor does it mention limitations like binary file handling or permission requirements. The word 'search' implies safety, but more explicit disclosure would be better.

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 a well-structured docstring with a one-line summary, an Args section, and a Returns section. Each parameter description is concise and informative, with no unnecessary fluff. The format is easy to scan and the summary is front-loaded. All information earns its place.

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?

For a tool with 6 parameters, no annotations, and no structured output schema, the description is largely complete: it covers all parameters and states the return format. It lacks guidance on when to use the tool and does not mention error handling or edge cases, but given the simplicity of a grep-like operation, it is sufficiently comprehensive. A 4 reflects the minor gaps.

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?

The input schema has 0% description coverage, but the description fully compensates by explaining each parameter: 'path: File path or directory to search', 'pattern: Text or regex pattern', 'recursive: Search recursively', 'ignore_case: Case-insensitive', 'context_lines: Lines of context', and 'host_name: Named host from SSH_HOSTS config; uses default host if omitted'. This adds significant meaning beyond the schema's bare titles and defaults, so a 5 is warranted.

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 clearly states 'Search for a text pattern in remote files' which is a specific verb and resource. It does not explicitly distinguish from the sibling tool 'search_files' (which likely searches file names), but the verb 'search' plus 'text pattern' implies content search. This meets 'clear' but lacks sibling differentiation, so 4 is appropriate.

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?

The description provides no guidance on when to use this tool versus alternatives like search_files, read_file, or tail_log. It only documents parameters and return values, not strategic context or exclusion criteria. There is no mention of specific use cases or when not to use it, so this is a clear gap.

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/zhouxiangjing/mcp-ssh'

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