Skip to main content
Glama

Find XAML Binding Usages

find_binding_usages
Read-onlyIdempotent

List every XAML/AXAML {Binding} site for a view-model member before renaming or deleting it, including redirected bindings and what each resolves against.

Instructions

List the {Binding ...} sites in the solution's .xaml and .axaml markup that name a member path, with what each one resolves against. find_usages carries a markup edge for a root member bound against the DataContext; this tool lists every site, redirected bindings included. find_unresolved_bindings checks whether a bound member exists on its view-model.

Use it before renaming or deleting a view-model member.

With a path: sites (view, line, path, form), siteCount, byForm, deeperSegmentSites(+Count), pathlessBindingCount, scannedFileCount, sitesTruncated, note. form is dataContext (no redirect), elementName, relativeSource, source or xBind (WinUI {x:Bind}; in byForm only when non-zero). A path matches as the whole path or as its ROOT segment: 'Foo' finds {Binding Foo} and {Binding Foo.Bar}. The 'Bar' of {Binding Foo.Bar} (a member of Foo's type) is reported apart in deeperSegmentSites. On an elementName or relativeSource binding a leading 'DataContext.' is the hop to the element's view-model: {Binding DataContext.Cmd, RelativeSource=...} is a site of 'Cmd'.

Without a path: the inventory - members (member, siteCount, byForm), most-bound first, with distinctMemberCount and totalSiteCount. Lists cap at 200; counts are true totals. pathlessBindingCount counts every binding without a plain member root (an empty {Binding}, {Binding Mode=OneWay}, an attached path) over the whole solution, whatever scope and form say.

Markup is read from disk on every call: a markup edit needs no refresh_session. Only {Binding} ({CompiledBinding} too in .axaml) and {x:Bind} are read: a binding built in code-behind, element-syntax , {TemplateBinding} and a path assembled at runtime are invisible here - zero sites means 'verify before renaming or deleting', not proof.

Read-only; test projects are scanned too. path is a markup path, not resolved as a symbol; an unknown form matches nothing (the note says so).

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_binding_usages"
  }
}

Input Schema

NameRequiredDescriptionDefault
formNoOptional form filter: 'dataContext', 'elementName', 'relativeSource', 'source' or 'xBind'. Omit for all forms. Applies to both views.
pathNoThe exact (case-sensitive) bound member path, e.g. 'GestureLabel' or 'Foo.Bar'. Omit for the inventory view (every bound root member with its site counts).
scopeNo'solution' (default) or a view-path substring (e.g. 'AIContextBuilder.UI/Views/Dialogs') to narrow which markup files are reported.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. Changed1 schema field changedv0.5.46520
    • changedInput schema / properties / form / description
      Previous value: -"Optional form filter: 'dataContext', 'elementName', 'relativeSource' or 'source'. Omit for all forms. Applies to both views."New value: +"Optional form filter: 'dataContext', 'elementName', 'relativeSource', 'source' or 'xBind'. Omit for all forms. Applies to both views."
  2. Changed2 schema fields changedv0.5.46513
    • changedInput schema / properties / path / description
      Previous value: -"The exact (case-sensitive) bound member path, e.g. 'GestureLabel' or 'Foo.Bar'. Omit for the inventory view (every bound path with its site counts)."New value: +"The exact (case-sensitive) bound member path, e.g. 'GestureLabel' or 'Foo.Bar'. Omit for the inventory view (every bound root member with its site counts)."
    • 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.8/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, but the description adds substantial behavior beyond them: markup is re-read from disk so no refresh_session is needed, only {Binding}/{CompiledBinding}/{x:Bind} are visible while code-behind bindings, element-syntax <Binding Path=.../>, {TemplateBinding} and runtime paths are invisible, lists cap at 200 while counts are true totals, test projects are included, and an unknown form silently matches nothing.

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 text is front-loaded with purpose and sibling routing, then cleanly split into 'With a path:' and 'Without a path:' sections, so it is navigable despite its length. It is dense and enumerates many return fields and caveats, but since there is no output schema each of those sentences earns its place.

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?

For a tool with no output schema, the description supplies the return shape for both views (sites, siteCount, byForm, deeperSegmentSites, pathlessBindingCount, scannedFileCount, sitesTruncated, note; members inventory with distinctMemberCount and totalSiteCount), plus truncation semantics and coverage limitations. An agent has everything needed to call it and interpret the result.

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 baseline would be 3, but the description adds real meaning the schema does not: 'path' matches either the whole path or its ROOT segment ('Foo' finds both {Binding Foo} and {Binding Foo.Bar}), deeper segments are reported separately, and a leading 'DataContext.' on elementName/relativeSource bindings is the hop to the view-model. It also clarifies that path is a markup path, not a resolved symbol.

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 names a specific verb and resource: list {Binding ...} sites in .xaml/.axaml markup that name a member path, and what each resolves against. It also explicitly distinguishes itself from find_usages (markup edge for a root member bound against DataContext) and find_unresolved_bindings (existence on the view-model), so an agent can separate the three without opening schemas.

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?

Gives an explicit when-to-use rule ('before renaming or deleting a view-model member') and routes to named alternatives with the condition that selects each. It also explains which invocation shape (with vs. without path) yields which view, and notes that zero sites means 'verify', not proof, which is genuine decision guidance.

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