Skip to main content
Glama

find_reflection_usage

Find calls to Java reflection API like Class.forName and Method.invoke that are invisible to static analysis and can break when code is refactored.

Instructions

Find places where Java reflection API is used.

USAGE: find_reflection_usage() OUTPUT: All reflection calls grouped by method type

Detects calls to:

  • Class.forName(), Class.newInstance()

  • Class.getMethod/getDeclaredMethod/getField/getDeclaredField

  • Class.getConstructor/getDeclaredConstructor

  • Method.invoke(), Field.get/set(), Constructor.newInstance()

These usages are invisible to static reference searches and can break when types or methods are renamed.

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNoMaximum results per reflection method (default 100)
Behavior3/5

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

No annotations present, so description must disclose behavior. It mentions it's a read operation (finding usages) and output format, but doesn't explicitly state no side effects or potential costs.

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?

Moderately sized, well-structured with usage line, output description, and list. Could be slightly more concise, but every sentence adds value.

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 output schema, description explains output grouping. Includes prerequisite. For a simple find tool, it's fairly complete, though could mention edge cases like no results.

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 description adds no extra meaning beyond schema. The parameter maxResults is already well-described in 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?

Clearly states it finds reflection API usages, lists specific methods detected, and explains why it's useful (invisible to static searches). Distinguishes from siblings like find_references which may not catch reflection.

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?

Provides usage format and prerequisite (load_project). Implicitly suggests when to use, but doesn't explicitly contrast with alternatives like find_method_references.

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