Skip to main content
Glama

suggest_imports

Find import candidates for an unresolved Java type by searching project sources, JDK, and libraries, then return ranked fully qualified names.

Instructions

Find import candidates for unresolved type.

USAGE: suggest_imports(typeName="List") OUTPUT: List of matching types with fully qualified names and relevance

Searches project sources, JDK, and libraries for types matching the simple name that the project can import: a type in the default package, or in a package its module does not export to the project (such as the JDK's internal packages), is never a candidate; the package's name never decides. Every candidate is ranked by relevance (java.util types ranked higher than java.awt, etc.; equally relevant ones by fully qualified name), then the first maxResults are returned. totalCandidates and meta.totalCount count every candidate; meta.truncated is true when candidates are left out.

Requires load_project to be called first.

Input Schema

NameRequiredDescriptionDefault
typeNameYesSimple type name to find imports for (e.g., 'List', 'Map')
maxResultsNoMaximum candidates to return (default 20)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.4
  2. Removedv1.3.3
  3. 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 at all, the description carries the full burden and does so: it discloses the search scope (project sources, JDK, libraries), the exclusion rule (default-package and non-exported packages are never candidates), the ranking algorithm (relevance, then fully qualified name), and the truncation contract (totalCandidates/meta.totalCount count all candidates while meta.truncated flags omissions). That is unusually rich behavioral disclosure for a read-only query tool.

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, then USAGE, then OUTPUT, then the detailed rules — a well-ordered structure. The middle paragraph is dense and slightly run-on around the package-export clause, but every sentence carries information an agent needs to interpret candidate eligibility and ordering.

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?

There is no output schema, yet the description still specifies the return shape (matching types with fully qualified names and relevance) plus the count/truncation metadata, and it names the load_project prerequisite. For a two-parameter query tool, nothing an agent needs to call it correctly is 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 typeName and maxResults are already documented, establishing a baseline of 3. The description goes beyond that by explaining what maxResults actually cuts ('then the first maxResults are returned') and how it relates to totalCandidates and meta.truncated, which is genuine semantic value not present in 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?

States a specific verb and resource ('Find import candidates for unresolved type') and immediately scopes it to the missing-import problem, which cleanly separates it from siblings like organize_imports (which applies imports) and search_symbols (which searches by name without import viability filtering). An agent can route to it without opening the 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?

The USAGE line gives a concrete invocation example and 'Requires load_project to be called first' supplies a hard prerequisite that would otherwise cause a failed call. It stops short of explicitly naming organize_imports or stating when-not-to-use it, so 5 is not warranted.

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