Skip to main content
Glama

find_instanceof_checks

Locate all instanceof checks for a Java type to identify type checking patterns, find polymorphism opportunities, and understand type discrimination logic in your codebase.

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)
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses the prerequisite (requires load_project) and output format ('All locations where instanceof checks against this type occur'), but lacks details on error handling, performance implications, or what 'locations' means (e.g., line numbers, files). It adds some context but is incomplete for behavioral traits.

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?

Well-structured with clear sections (description, JDT-UNIQUE, USAGE, OUTPUT, Useful for, Requires), but slightly verbose in the 'Useful for' list. Every sentence adds value, and it's front-loaded with the core purpose, though minor trimming could improve conciseness.

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 no annotations and no output schema, the description does well by explaining purpose, usage, output, and prerequisites. It covers key aspects like the search scope and tool uniqueness, but could benefit from more detail on behavioral traits (e.g., error cases) to be fully complete for a search tool.

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 description coverage is 100%, so the baseline is 3. The description adds value by specifying 'Provide fully qualified type name' for typeName, clarifying the expected format beyond the schema's 'Fully qualified type name'. However, it doesn't mention maxResults, leaving the schema to cover it fully.

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 specific verb 'find' and resource 'instanceof checks for a type', with the example 'x instanceof Foo' making it concrete. It distinguishes from siblings by focusing on instanceof checks specifically, unlike broader tools like find_references or find_type_instantiations.

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?

Explicitly states when to use ('Useful for: Identifying type checking patterns, finding polymorphism opportunities, understanding type discrimination logic') and includes a prerequisite ('Requires load_project to be called first'). It also distinguishes from LSP alternatives via 'JDT-UNIQUE: This fine-grained search is not available in LSP.'

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