Skip to main content
Glama

find_instanceof_checks

Find all instanceof checks for a given type to identify type discrimination logic, enabling replacement with polymorphism or understanding type-checking patterns.

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 fully relies on text to disclose behavior. It states the tool is a fine-grained search, not in LSP, and requires load_project. It implies a read-only operation (finding occurrences) without side effects. Could mention performance but sufficiently transparent for this type of 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, well-structured with clear sections (description, JDT-UNIQUE, USAGE, OUTPUT, Useful for, Requirement). Every sentence adds value; no fluff. The use of bullet points enhances readability for an AI agent.

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, no annotations), the description covers purpose, usage, output, and prerequisite. It could be more complete by mentioning return format or pagination, but for a find tool this is adequate. Missing details like maxResults behavior are in schema.

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 baseline is 3. The description adds little beyond schema: 'Provide fully qualified type name' and 'Maximum results to return (default 100)' are already covered. However, it does mention 'OUTPUT: All locations' which provides context but not parameter-level detail. No significant added value.

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 type, with a specific verb (find) and resource (instanceof checks). It differentiates from siblings by noting its JDT-unique capability not available in LSP, which sets it apart from other search tools like find_references or find_casts.

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 explains when to use (for identifying type checking patterns, polymorphism opportunities) and includes a prerequisite ('Requires load_project to be called first'). It does not explicitly mention alternatives or when not to use, but the context signals and sibling tool list provide enough differentiation for an AI agent.

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