Skip to main content
Glama

analyze_type

Retrieve Java type information, members, hierarchy, usage, and diagnostics in one call, replacing multiple queries.

Instructions

Comprehensive type analysis in a single call.

USAGE: analyze_type(typeName="com.example.Foo") OUTPUT: Type info, members, hierarchy, usage summary, diagnostics

Combines:

  • Type info (name, kind, modifiers, location)

  • All members (methods, fields, constructors)

  • Type hierarchy (superclass, interfaces, subtypes)

  • Usage summary (instantiations, casts, etc.)

  • Diagnostics for the type's file

Use this instead of multiple calls to get_type_members + get_type_hierarchy + get_type_usage_summary.

hierarchy.unresolvedSupertypes, present only when there are any, names each supertype the compiler cannot resolve (a missing dependency), as the declaration writes it, with the type whose declaration names it: this type or one of its supertypes. The hierarchy's potentialMatches are places naming the type as a supertype that JDT could not confirm; the usage summary's are uses it could not confirm, the first maxUsages of each category. maxUsages below 0 is INVALID_PARAMETER.

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 or simple type name
maxUsagesNoMax usages per category, 0 or more (default 10)
includeUsagesNoInclude usage analysis (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.5.3
    • changedInput schema / properties / maxUsages / description
      Previous value: -"Max usages per category (default 10)"New value: +"Max usages per category, 0 or more (default 10)"
  2. Addedv1.3.4
  3. Removedv1.3.3
  4. First observedv1.2.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and delivers: it documents the output shape, discloses that hierarchy.unresolvedSupertypes and potentialMatches are conditionally present, explains what potentialMatches counts and why, and states maxUsages below 0 is INVALID_PARAMETER. These are real behavioral traits beyond the schema.

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, usage, and output, and each section is labeled. The middle paragraphs on unresolvedSupertypes and potentialMatches are dense and slightly tangled, but since there is no output schema they largely earn their place. Minor tightening would help.

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 must explain return values, and it does in detail, including conditional fields and the unresolved/uncertain match semantics. It also supplies the prerequisite and parameter error condition, leaving nothing essential for a correct call missing.

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 is 3. The description adds a validation rule absent from the schema ('maxUsages below 0 is INVALID_PARAMETER') and clarifies the semantics of the potentialMatches/maxUsages listing, giving it an edge over the schema alone.

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+resource ('Comprehensive type analysis') and enumerates exactly what it aggregates: type info, members, hierarchy, usage summary, and diagnostics. It explicitly names the siblings it replaces (get_type_members, get_type_hierarchy, get_type_usage_summary), so an agent can distinguish it from those 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?

Explicitly routes the agent away from three sibling tools and states the prerequisite 'Requires load_project to be called first.' It gives a concrete usage example. It stops short of a 'when-not' condition (e.g. when a single-purpose tool is preferable), so it is strong but not fully exhaustive.

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