Skip to main content
Glama

Resolve Dependency Injection

resolve_injection
Read-onlyIdempotent

Identify what Microsoft DI or MEF registers for a service, including lifetime, implementation, and site, so you can confirm how dependencies are wired.

Instructions

Resolve a Microsoft DI or MEF registration: what is registered for a service, with lifetime and site. Not usage (find_usages), implementers (find_implementations), construction (instantiation_sites).

It reads Add{Singleton,Scoped,Transient}, TryAdd*, descriptor adds built at the call, AddHostedService, project-local helpers registering their own type arguments, and a foreach over a static new(typeof(Service), typeof(Impl)) table. A key, and a closing, is a service of its own (IRepo, IRepo); open IRepo<> is read. Not read: a descriptor built elsewhere, AddHttpClient-style helpers, Scrutor, other containers. Umbraco collection builders are listed apart (collectionBuilders).

Returns JSON: registrations (serviceType, implementationType [= service if self/instance], lifetime, note, location, project, declaringMethod, key, targetFrameworks: a multi-targeted project's call is one row; note 'inferred, not read' = from a package helper's call shape AddSingletonAs().As(): lifetime from its name, never ambiguous or a winner) and: multiRegistration / registrationSites; ambiguous (possible conflict: ONE site registers several implementations of one service, receivers not compared, not consumed as a collection); effectiveRegistration (2+ calls: the winner a single-service resolve gets, read in ONE straight-line site; else null + reason); consumedAsCollection; constructorConsumerCount (plain ctor parameters); otherConsumers (GetService outside a registration factory, [Inject], @inject: per form); optionalDependencies (optional ctor parameters: yes/no/unknown).

An empty list says why: resolvedKind 'not_found' plus 'nearest' = no such name; else a 'note' names the forms not read and which the solution holds - empty means 'not statically visible', never 'not registered'.

Test projects count only with includeTests=true; testRegistrationsFiltered counts what that hid. interface is the SERVICE type (a self-registered class too); a closed form (IRepo) lists that closing and IRepo<> (typeArgumentFilter: the rest).

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

Input Schema

NameRequiredDescriptionDefault
siteNoOptional: narrow to registrations whose file path contains this substring.
interfaceYesThe interface simple or fully-qualified name, e.g. 'ICodeAnalyzer'. A simple name lists every type of that name; a qualified one ('App.Settings.IPanel') leaves out same-named types of other namespaces and says how many. A closed generic form ('IHandler<Saved>') lists only the registrations serving that closing; 'IHandler' or 'IHandler<T>' lists every closing.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.
includeTestsNoInclude registrations declared in test projects (default false - production focus).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46517
    • changedInput schema / properties / interface / description
      Previous value: -"The interface simple or fully-qualified name, e.g. 'ICodeAnalyzer'. A closed generic form ('IHandler<Saved>') lists only the registrations serving that closing; 'IHandler' or 'IHandler<T>' lists every closing."New value: +"The interface simple or fully-qualified name, e.g. 'ICodeAnalyzer'. A simple name lists every type of that name; a qualified one ('App.Settings.IPanel') leaves out same-named types of other namespaces and says how many. A closed generic form ('IHandler<Saved>') lists only the registrations serving that closing; 'IHandler' or 'IHandler<T>' lists every closing."
  2. Changed1 schema field changedv0.5.46514
    • changedInput schema / properties / interface / description
      Previous value: -"The interface simple or fully-qualified name, e.g. 'ICodeAnalyzer'."New value: +"The interface simple or fully-qualified name, e.g. 'ICodeAnalyzer'. A closed generic form ('IHandler<Saved>') lists only the registrations serving that closing; 'IHandler' or 'IHandler<T>' lists every closing."
  3. 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."
  4. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already cover readOnly/idempotent/non-destructive, and the description adds substantial context beyond them: exactly which registration forms are read vs. skipped (descriptor built elsewhere, AddHttpClient helpers, Scrutor, other containers) and what an empty result means. It is dense and useful, though some phrasing is ambiguous enough to slightly muddy the behavioral picture.

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?

Purpose and exclusions are well front-loaded, but the body is a wall of dense, fragmented sentences with heavy parenthetical nesting ('A key, and a closing, is a service of its own'). Given the tool's complexity some density is warranted, yet several clauses repeat schema content and could be trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description carries the full burden of explaining the returned JSON and does so in detail (registrations fields, ambiguous, effectiveRegistration, consumer counts, empty-result reasons). It also covers test filtering, making it nearly complete for a complex tool, only undermined slightly by the phantom parameter name.

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 the schema already documents interface/sessionId/site/includeTests thoroughly, and the description's interface explanation largely restates it. It also references 'typeArgumentFilter', which is not an actual parameter in the schema, adding confusion rather than 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?

The first sentence gives a specific verb, resource, and scope ('Resolve a Microsoft DI or MEF registration: what is registered for a service, with lifetime and site') and immediately names the three siblings it is not (find_usages, find_implementations, instantiation_sites). An agent can distinguish it from neighbors 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 exclusions route the agent: usage vs. implementers vs. construction each map to a named alternative tool. It also states the includeTests toggle's effect and the empty-list semantics ('never not registered'), which function as usage rules.

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