Skip to main content
Glama

Find Event Subscriptions

find_by_event_subscription
Read-onlyIdempotent

Find which C# types subscribe to an event via '+=' anywhere in the type, including external events like Button.Click. Answers 'who listens to this event?'.

Instructions

Find the TYPES that subscribe to a C# event: a '+=' whose left side resolves to an event, anywhere in the type (constructor, method, accessor, lambda). find_usages on an event the solution declares lists the subscribing, unsubscribing and raising METHODS; this tool works at type level and also sees external events ('Button.Click').

Use it for 'who listens to this event?' and to find where handlers are wired. Only subscriptions ('+=') are read, not '-='; a '+=' on a number, a string or a delegate field is not a subscription and is skipped.

Returns scope, event, typesScanned, subscriptionSitesChecked, subscriptionSitesUnresolved, matches - a capped envelope of at most 200 types (name, namespace, events), sorted by namespace and name - and when they apply 'note', availableEvents and testMatchesFiltered. A hit lists ALL event keys the type subscribes to ('DeclaringType.EventName'), not only the one filtered on.

Reading an empty answer: on zero matches availableEvents lists the events subscribed in scope. When testMatchesFiltered is present, read it first - the name was right and only its subscribers were tests. An EMPTY availableEvents means no subscription was RECORDED, which is not the same as none being present: recognition needs a resolved left side, so in a project whose types do not resolve every subscription is missing. The two site counts settle it: subscriptionSitesChecked is every '+=' the rule was applied to, subscriptionSitesUnresolved those whose left side could not be resolved. '0 of 0' is nothing to see, '0 of 7, 0 unresolved' a real absence, '0 of 7, 7 unresolved' an unmeasured scope - and that one carries a note.

Read-only; works on a recalled session. eventName is matched exactly, never as a substring; omit it to list every subscribing type. Test-project types are excluded by default (includeTests=true includes them).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scopeNo'solution' (default) or a namespace prefix (e.g. 'MyApp.UI') to narrow scope.solution
eventNameNoFilter to types subscribing to this event - the event name ('Click') or the qualified 'DeclaringType.EventName' key ('Button.Click'), case-insensitive. Omit to list every type with any subscription.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.
includeTestsNoInclude test-project types (default false - production focus; test setup that wires events would drown the signal).

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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."
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), so the bar is lower. The description still adds substantial behavior beyond that: a 200-type cap, exact-match semantics, default test exclusion, and detailed interpretation of empty results via subscriptionSitesChecked/Unresolved and the availableEvents/note/testMatchesFiltered fields.

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 and sibling differentiation before the dense return-shape guidance. The empty-result interpretation (the three site-count scenarios) is verbose, but with no output schema present, explaining the return envelope earns its place. Slightly long but well organized.

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, so the description responsibly documents the return envelope (scope, event, counts, matches, note, availableEvents, testMatchesFiltered). Combined with the read-only annotations and full param coverage, an agent has everything needed to call and interpret the tool.

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 description coverage is 100%, so the baseline is 3, but the description adds real meaning: eventName is matched exactly, never as a substring, and omitting it lists every subscribing type; includeTests rationale is also explained. This goes beyond what the schema fields state.

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: finding TYPES that subscribe to a C# event via '+='. It explicitly distinguishes itself from the closest sibling, find_usages, by noting that tool lists subscribing/unsubscribing/raising METHODS while this works at type level and also sees external events like 'Button.Click'.

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?

Provides explicit use cases ('who listens to this event?', finding handler wiring), names the alternative (find_usages), and states exclusions ('+=' only, not '-='; a '+=' on a number, string or delegate field is skipped). When and when-not are both covered.

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