Skip to main content
Glama

Find Usages of a Symbol

find_usages
Read-onlyIdempotent

Lists who uses a C# symbol (direct fan-in) by resolved kind before you change or delete it, replacing grep with semantic, read-only reference results.

Instructions

List who uses a symbol (direct fan-in); impact_of_change adds closure + risk, calls_external external members.

Use it before changing or deleting a symbol, not grep. Listed per resolvedKind: 'type' - the types that reference it (a doc cref too: docCrefOnly), plus markup views; 'method' - its callers, overloads unioned ('overloads'; item 'calls': its own), and the types whose doc cref names it (docCrefOnly); 'property' or 'field' - its readers and writers; 'event' - its raisers and (un)subscribers; 'enum_member' - its references; 'operator' ('op_Equality') - its uses, casts too; 'constructor' ('Type.Type') - the type's construction and injection sites. Test users included.

Returns symbol, resolvedKind, usedBy (capped envelope: items, count, totalFound, truncated; max 100). Item: {name, file, line}, one per user: file is solution-relative, line its declaration's start (not the reference); 'files' [{file, line}] for a multi-file type (holding files, else all); absent if unknown; users sharing a name add 'fullName' (a type), 'project'. Optional: 'note' first (an empty or constructor answer, unresolved core references), 'namesakes' (several types share it, unioned), 'collision' (a same-named other kind, not counted), 'viaContract' + 'viaContractNote' (a qualified method's contract or virtual-base callers), 'selfReferences' (users on the member's own type), 'textuallyInvisibleUsers' (users not naming it), 'nearest' (on 'not_found': a close name), 'resourceKeyNote' (markup keys the type; those views: find_resource_usages).

An empty usedBy on a resolved symbol is not proof of dead code: entry points, DI, reflection, generators and unrecorded markup leave no reference. 'not_found' is not 'undeclared': a delegate type and an unread qualified name answer it; 'note' may say why.

Read-only, case-sensitive. A type takes its simple name; a member 'Type.Member' (one type's) or a bare name: ONE kind, the first in the order above with users, unioned over its same-named members.

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": {
      "sessionId": "<sessionId>",
      "symbol": "<symbol>"
    },
    "name": "find_usages"
  }
}

Input Schema

NameRequiredDescriptionDefault
symbolYesThe exact (case-sensitive) type, method, property, field, event, enum-member or operator (metadata) name - the qualified Type.Member form for a member, a qualified type name ('Ns.Type', 'Outer.Inner') where no type of that simple name lies outside it (a 'note' says so; else not_found says why) - or 'Type.Type' for a type's CONSTRUCTOR (see the tool description: the answer is the type's construction/injection sites, overloads unioned).
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.
includeTestsNoInclude users declared in test projects (default true). false lists production users only, BEFORE the 100-item cap, and 'testUsersFiltered' says how many were left out; viaContract keeps counting every caller.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46521
    • changedInput schema / properties / symbol / description
      Previous value: -"The exact (case-sensitive) type, method, property, field, event, enum-member or operator (metadata) name - the qualified Type.Member form for a member - or 'Type.Type' for a type's CONSTRUCTOR (see the tool description: the answer is the type's construction/injection sites, overloads unioned)."New value: +"The exact (case-sensitive) type, method, property, field, event, enum-member or operator (metadata) name - the qualified Type.Member form for a member, a qualified type name ('Ns.Type', 'Outer.Inner') where no type of that simple name lies outside it (a 'note' says so; else not_found says why) - or 'Type.Type' for a type's CONSTRUCTOR (see the tool description: the answer is the type's construction/injection sites, overloads unioned)."
  2. Changed1 schema field changedv0.5.46516
    • addedInput schema / properties / includeTests
      Added value: +{
      +  "default": true,
      +  "description": "Include users declared in test projects (default true). false lists production users only, BEFORE the 100-item cap, and 'testUsersFiltered' says how many were left out; viaContract keeps counting every caller.",
      +  "type": "boolean"
      +}
  3. Changed1 schema field changedv0.5.46514
    • changedInput schema / properties / symbol / description
      Previous value: -"The exact (case-sensitive) type, method, property, field, event or enum-member name - the qualified Type.Member form for a member - or 'Type.Type' for a type's CONSTRUCTOR (see the tool description: the answer is the type's construction/injection sites, overloads unioned)."New value: +"The exact (case-sensitive) type, method, property, field, event, enum-member or operator (metadata) name - the qualified Type.Member form for a member - or 'Type.Type' for a type's CONSTRUCTOR (see the tool description: the answer is the type's construction/injection sites, overloads unioned)."
  4. Changed1 schema field changedv0.5.46513
    • changedInput schema / properties / sessionId / description
      Previous value: -"The session_id returned by analyze_solution."New value: +"The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use."
  5. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already cover read-only/idempotent/non-destructive/closed-world, so the description is free to add real behavioral context — and it does: a hard 100-item cap on usedBy, what 'line' means (declaration start, not the reference), case sensitivity, name-resolution order across kinds, and optional fields like 'collision', 'namesakes', 'viaContract'. It also warns that an empty usedBy is not proof of dead code (entry points, DI, reflection, generators) and that 'not_found' differs from 'undeclared', which are exactly the misinterpretations an agent would make.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loading is good: purpose plus sibling routing occupy the first two sentences. After that it becomes a dense block of semicolon-chained clauses and parenthesized asides ('(metadata)', "(a doc cref too: docCrefOnly)") that is hard to scan; several of the resolution rules would read better as a short list than as one sprawling paragraph.

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?

No output schema exists, and the description compensates fully by enumerating the envelope (items, count, totalFound, truncated) and the item shape ({name, file, line}). Combined with the per-kind answer semantics and the false-negative caveats, an agent has everything needed to call this and interpret the result correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all three parameters; the description nonetheless adds meaning the schema only gestures at — the kind-resolution ordering, the 'Type.Type' constructor shortcut, 'Type.Member' qualification, and that includeTests filtering happens before the cap. Marginal gain is real but mostly a restatement of the schema's own long-form text.

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 opening sentence gives a specific verb and resource ('List who uses a symbol') plus its scope ('direct fan-in'), and immediately distinguishes it from two siblings by name (impact_of_change = closure + risk, calls_external = external members). An agent can select this over those alternatives without opening any schema.

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 when-to-use: 'before changing or deleting a symbol, not grep.' It also routes away from itself — impact_of_change for closure/risk, calls_external for external members, find_resource_usages for markup keys. That is both a positive condition and named alternatives, which is the top bar.

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