Skip to main content
Glama

Find XAML Resource Usages

find_resource_usages
Read-onlyIdempotent

Finds where XAML/AXAML and C# resource string keys are defined and referenced, and audits never-referenced keys, same-file collisions, and keys no markup defines.

Instructions

Resource-key fan-in across the solution's XAML/AXAML markup AND its C# sources - the question the C# symbol graph cannot answer because resources are wired by string key, not by symbol. With a key: where it is DEFINED (x:Key, file:line), every REFERENCE (file:line + kind: 'static'/'dynamic' for the markup extension, since a theme-swapped brush must be dynamic; 'theme' for WinUI's {ThemeResource}; 'code' for a C# string literal equal to the key; 'callerMemberName' for a C# member named like the key that reads it through a [CallerMemberName] resource accessor), and same-file duplicate definitions (in a compiled resource dictionary a duplicate silently shadows a neighboring key; a same-named key in DIFFERENT files is usually a theme pair, so only same-file counts as a collision). themeReferenceCount and callerMemberNameReferenceCount appear only when not zero. Without a key: the audit view - every never-referenced key (deletion candidates; deleting a still-referenced key compiles clean and throws only at runtime) + all same-file collisions + every referenced key no markup defines: misspelledKeyCandidates (one slip from a defined key) and notDefinedInSolutionKeys (most often a theme's or the platform's key - unknown, not broken). Reads the CURRENT .xaml/.axaml/.cs files on disk (bin/obj/.vs excluded) - never stale after an edit, no refresh_session needed, works on recalled sessions. STRING keys only (a structural x:Key="{x:Type ...}" is out of scope); the ResourceKey= long form, the element and a markup extension the solution derives from StaticResourceExtension/DynamicResourceExtension are read. XML-commented markup is ignored. Still invisible: a key assembled at runtime, a non-.cs source, a resource-extension subclass from a referenced library, a library template resolving the key from its own dll - zero references means 'verify before deleting', not proof. Lists capped at 200.

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>"
    },
    "name": "find_resource_usages"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyNoThe exact (case-sensitive) resource key, e.g. 'TextPrimaryBrush'. Omit for the audit view (never-referenced keys, same-file collisions, keys no markup defines).
scopeNo'solution' (default) or a view-path substring (e.g. 'AIContextBuilder.UI/') to narrow which files are reported. In the audit view the scope narrows the DEFINITIONS under audit; references still count solution-wide, so a key referenced outside the scope is not a false orphan. For the keys no markup defines it is the other way round: the scope narrows the REFERENCES under audit, and a definition anywhere in the solution counts.solution
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.5.46517
    • changedInput schema / properties / key / description
      Previous value: -"The exact (case-sensitive) resource key, e.g. 'TextPrimaryBrush'. Omit for the audit view (never-referenced keys + same-file collisions)."New value: +"The exact (case-sensitive) resource key, e.g. 'TextPrimaryBrush'. Omit for the audit view (never-referenced keys, same-file collisions, keys no markup defines)."
    • changedInput schema / properties / scope / description
      Previous value: -"'solution' (default) or a view-path substring (e.g. 'AIContextBuilder.UI/') to narrow which files are reported. In the audit view the scope narrows the DEFINITIONS under audit; references still count solution-wide, so a key referenced outside the scope is not a false orphan."New value: +"'solution' (default) or a view-path substring (e.g. 'AIContextBuilder.UI/') to narrow which files are reported. In the audit view the scope narrows the DEFINITIONS under audit; references still count solution-wide, so a key referenced outside the scope is not a false orphan. For the keys no markup defines it is the other way round: the scope narrows the REFERENCES under audit, and a definition anywhere in the solution counts."
  2. 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."
  3. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, the description discloses important behavior: it reads current files on disk, excludes bin/obj/.vs, works on recalled sessions without refresh_session, only handles string keys, ignores XML-commented markup, and caps lists at 200. It also explains collision semantics and caveats around runtime-assembled keys and library templates, which is unusually rich context for an agent.

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?

The description is front-loaded with purpose and modes, but it is extremely dense and long, with several run-on clauses covering edge cases and limitations. Much of the detail is useful, yet the lack of structure and the sheer volume make it harder to scan than necessary.

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?

Given a complex tool with no output schema, the description covers the return shape well: definitions with file:line, reference kinds, duplicate handling, conditional count fields, and the full audit-view categories. It also states major limitations and what remains invisible, making it complete enough for an agent to invoke correctly.

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 input schema already documents key, scope, and sessionId semantics thoroughly. The description reinforces the key/no-key distinction and scope behavior but adds little parameter syntax or format detail beyond what the schema already provides, so the baseline 3 is appropriate.

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 gives a specific verb and resource: resource-key fan-in across XAML/AXAML markup and C# sources. It explicitly distinguishes the tool from the C# symbol graph by explaining that XAML resources are wired by string key rather than symbol, so an agent can immediately tell what this tool covers that find_usages does not.

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 clearly defines two modes: passing a key to get definitions/references, and omitting it for an audit view of never-referenced keys, collisions, and undefined keys. It also gives strong context about when zero references should be treated as 'verify before deleting.' It does not explicitly name sibling tools like find_usages or find_binding_usages as alternatives, which keeps it from a 5.

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