Skip to main content
Glama

find_casts

Locate all type casts to a specified Java class to identify unsafe downcasts, find refactoring opportunities, and analyze type conversion patterns in your codebase.

Instructions

Find all casts to a type ((Foo) x expressions).

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

USAGE: Provide fully qualified type name OUTPUT: All locations where casting to this type occurs

Useful for:

  • Identifying unsafe downcasts

  • Finding refactoring opportunities (replace cast with polymorphism)

  • Understanding type conversion patterns

Requires load_project to be called first.

Input Schema

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

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

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: the tool performs a search (implying read-only, non-destructive), outputs 'All locations where casting to this type occurs,' and has a prerequisite ('Requires load_project'). It also notes a uniqueness aspect ('JDT-UNIQUE: This fine-grained search is not available in LSP.'), adding context. However, it lacks details on rate limits, error handling, or output format specifics, which are minor gaps.

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?

The description is well-structured with sections (e.g., 'USAGE:', 'OUTPUT:', 'Useful for:', 'Requires'), making it easy to scan. It is appropriately sized, with each sentence adding value, though it could be slightly more concise by integrating some points (e.g., combining the first two lines). No wasted text, but minor room for improvement in flow.

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 complexity (search operation with prerequisites), no annotations, and no output schema, the description does a good job covering purpose, usage, and behavior. It explains the output ('All locations where casting to this type occurs') and includes prerequisite information. However, without an output schema, it could benefit from more details on the return format (e.g., structure of results), which is a slight gap.

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 description coverage is 100%, so the schema already documents both parameters ('typeName' and 'maxResults') with descriptions. The description adds minimal value beyond the schema: it reiterates 'Provide fully qualified type name' for 'typeName' but does not explain parameter interactions or provide additional semantics. This meets the baseline of 3 when schema coverage is high.

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 explicitly states the tool's purpose: 'Find all casts to a type ((Foo) x expressions).' It specifies the verb ('find'), resource ('casts'), and scope ('to a type'), and distinguishes it from siblings by noting it's a 'fine-grained search not available in LSP.' This is specific and clearly differentiates it from other analysis tools.

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 context for when to use the tool: 'Useful for: - Identifying unsafe downcasts - Finding refactoring opportunities - Understanding type conversion patterns' and includes a prerequisite: 'Requires load_project to be called first.' However, it does not explicitly state when not to use it or name alternatives among siblings, which prevents a score of 5.

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