Skip to main content
Glama

find_type_instantiations

Find all 'new' instantiations of a Java type to analyze object creation patterns and coupling points. Requires a fully qualified type name.

Instructions

Find all instantiations of a type (new Foo() calls).

JDT-UNIQUE: This fine-grained search is not available in LSP.

USAGE: Provide fully qualified type name OUTPUT: All locations where the type is instantiated with 'new'

Useful for:

  • Understanding object creation patterns

  • Identifying factory method candidates

  • Finding coupling points

potentialMatches, present only when there are any, holds the places JDT's search reports as possible matches but cannot confirm, because a type or name there does not resolve (a missing dependency or a compile error): count is their exact number, and locations lists them, as many as the results it stands beside may list. They are never counted or listed as results.

Requires load_project to be called first.

Input Schema

NameRequiredDescriptionDefault
typeNameYesFully qualified type name (e.g., 'java.util.ArrayList')
maxResultsNoMaximum results to return (default 100)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.4
  2. Removedv1.3.3
  3. First observedv1.2.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden, and it does meaningful work: it explains that potentialMatches holds unconfirmed/unresolved candidates that are never counted as results, and it discloses the load_project prerequisite. It does not state read-only safety or pagination behavior, leaving that gap.

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?

Purpose is front-loaded and the labeled sections (USAGE, OUTPUT, Useful for) scan quickly. The potentialMatches paragraph is dense and awkwardly worded ('as many as the results it stands beside may list'), which costs it a point.

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?

There is no output schema, so the description must explain return semantics, and it does: locations of `new` sites plus the potentialMatches structure and counting rules. The main omission is that the return shape is described in prose rather than a schema, and maxResults behavior is never addressed.

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 both typeName and maxResults are already documented in the schema; baseline is 3. The description only reiterates the fully-qualified-name requirement and says nothing about maxResults or default behavior, adding marginal value beyond the schema.

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 precise verb+resource (find all instantiations of a type, i.e. `new Foo()` calls) and even disambiguates from the LSP-equivalent tools by labeling itself 'JDT-UNIQUE'. An agent can distinguish it from siblings like find_instanceof_checks or find_method_references 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 Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states the calling convention explicitly ('USAGE: Provide fully qualified type name'), lists concrete scenarios (object creation patterns, factory candidates, coupling points), and gives the prerequisite ('Requires load_project to be called first'). It does not name alternative tools or state when NOT to use it, so it falls short of a full 5.

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