Skip to main content
Glama

Find where something is in many/huge files

locate_in_files

Find the files and line ranges most likely containing a bug's cause, a feature's implementation, or a setting definition by describing symptoms or code behavior.

Instructions

Find which files and lines most likely contain what you describe — the cause of a bug from its symptoms, the code implementing a feature, where a setting is defined. Pass 1: every file is split into chunks and ALL chunks are scored by the decision model (nothing is truncated; very cheap even for megabytes). Pass 2: the best chunks are re-scored in small line windows to pinpoint the lines. Returns ranked file:line ranges with probabilities, a per-file ranking and the code of the top locations, so you can go straight to the fix.

Input Schema

NameRequiredDescriptionDefault
topNoHow many locations and files to list (default 5)
modelNoOverride the OpenRouter decision model for this call, e.g. cloudflare/clef (see list_models)
pathsYesFiles and/or directories to read (absolute or relative to the project root)
queryYesWhat to find, as specific as possible: symptoms, error text, expected vs actual behaviour, names involved
dry_runNoOnly list which files would be scanned and the estimated tokens; no API call
excludeNoExtra globs to skip, e.g. ["**/*.test.ts"]
includeNoGlob patterns inside directories, e.g. ["**/*.ts", "docs/**/*.md"]. Default: all text files
snippetsNoInclude the code of this many top locations, with line numbers (default 3, 0 = only file:line ranges)
chunk_charsNoChunk size in chars for pass 1 (default 20000; capped to what the model's context fits)
window_linesNoSize of the pinpointed line windows (default 40)
respect_gitignoreNoSkip files ignored by the directory's .gitignore (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it explains the two-pass chunking and line-window scoring, notes that nothing is truncated and that scanning is cheap even for megabytes, and describes the ranked output with probabilities and snippets. It omits permission, rate-limit, and failure-mode details, which keeps it from 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 the purpose and then structured into Pass 1, Pass 2, and return-value details. It is dense but mostly earns its length; the two-pass explanation could be tightened slightly.

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 an 11-parameter search tool with no annotations and no output schema, the description provides enough behavioral context: what gets scanned, how scoring works, and what the ranked output contains. It leaves out operational details like API cost semantics or authentication, but the core invocation context is complete.

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 the schema already documents all 11 parameters in detail. The description reinforces query specificity through the use-case examples but adds no parameter-level guidance beyond what the schema already provides.

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 a specific verb and resource: 'Find which files and lines most likely contain what you describe.' It adds concrete use cases (bug symptoms, feature implementation, setting definitions) that make the tool's purpose immediately distinguishable from generic file classification or listing.

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?

It gives clear contexts for when to use the tool, such as locating a bug's cause from symptoms or finding where a setting is defined. It does not explicitly name alternatives like classify_files or decide_files, nor does it state when not to use this tool, so it falls short of a 5.

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