Skip to main content
Glama

find_references

Read-only

Lists every occurrence of an identifier in a source file by line and source text, in file order, to survey uses before a rename. Read-only and syntactic; not scope-aware or cross-file.

Instructions

List each occurrence of an identifier in a source file as line N: <source line>, in file order. Read-only and syntactic, with no scope analysis, so unrelated identifiers of the same name show up too. C++ destructors and operators go by their list_symbols names (~A, operator==).

Use this when: surveying a name's uses in a file before a rename. Don't use this when: you need references across files or by scope (use a language server).

Example: target="LRUCache"

Input Schema

NameRequiredDescriptionDefault
targetYesIdentifier to find, a plain name, not a dotted path (e.g. 'LRUCache').
file_pathYesAbsolute path to the source or config file.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.2.0
    • addedInput schema / properties / file_path / description
      Added value: +"Absolute path to the source or config file."
    • addedInput schema / properties / target / description
      Added value: +"Identifier to find, a plain name, not a dotted path (e.g. 'LRUCache')."
  2. First observedv2.0.1

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare a safe read-only profile, and the description adds substantive context beyond them: the analysis is syntactic with no scope analysis, so false-positive matches occur, plus how C++ destructors and operators are named. This materially changes how an agent should interpret results.

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?

Front-loaded with purpose, then structured when/when-not blocks and a short example — efficient overall. The trailing example largely duplicates the schema's own example, so it is mildly redundant but not wasteful.

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?

With annotations, a 100%-covered two-param schema, and an output schema, the description supplies exactly the missing pieces: output format, the syntactic-analysis caveat, and routing to a language server when scope matters.

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 coverage is 100%, so both parameters are already documented, including the 'plain name, not a dotted path' constraint and the LRUCache example. The description's example repeats that guidance rather than adding new meaning.

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?

States a specific verb and resource (list each occurrence of an identifier in a source file) and even fixes the output shape (`line N: <source line>`, file order). It is clearly distinguishable from siblings like list_symbols or read_symbol.

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

Usage Guidelines5/5

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

Explicit 'Use this when: surveying a name's uses in a file before a rename' and 'Don't use this when: you need references across files or by scope (use a language server)' — both the trigger and the alternative are named.

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