Skip to main content
Glama

find_instanceof_checks

Locate all instanceof checks for a specified type in your Java code. Identify type checking patterns to refactor towards polymorphism and improve code design.

Instructions

Find all instanceof checks for a type (x instanceof Foo).

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

USAGE: Provide fully qualified type name OUTPUT: All locations where instanceof checks against this type occur

Useful for:

  • Identifying type checking patterns

  • Finding polymorphism opportunities (replace instanceof with virtual dispatch)

  • Understanding type discrimination logic

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNameYesFully qualified type name to find instanceof checks for
maxResultsNoMaximum results to return (default 100)
Behavior4/5

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

With no annotations, the description carries full weight. It discloses the prerequisite (load_project), the output type (locations), and the non-destructive nature implicitly. However, it lacks details on output format (e.g., file paths, line numbers) and any potential performance considerations. Overall, it provides adequate transparency for a search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured with clear sections (main description, uniqueness, usage, output, use cases, prerequisite). Every sentence is meaningful and without redundancy. It avoids unnecessary details and is efficiently front-loaded.

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?

Given the tool's simplicity (2 params, no output schema), the description covers essential aspects: purpose, prerequisite, usage, and use cases. It does not specify the output format in detail, but that is acceptable for a search tool. It is sufficiently complete for the agent to use correctly.

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 description adds minimal new parameter information beyond what the schema already provides. It reinforces the requirement for a fully qualified name and the prerequisite, but does not elaborate on maxResults or value constraints. Baseline of 3 is appropriate.

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 clearly states the tool finds all instanceof checks for a given fully qualified type, with an example syntax. It also highlights its unique value by noting it's not available in LSP, distinguishing it from standard search tools. The purpose is specific, actionable, and well-defined.

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 description provides clear usage instructions: provide a fully qualified type name and call load_project first. It lists useful scenarios (identifying patterns, polymorphism opportunities, type discrimination). However, it does not explicitly state when not to use this tool or mention alternatives among sibling tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pzalutski-pixel/javalens-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server