Skip to main content
Glama

find_reflection_usage

Identifies Java reflection API usage including Class.forName, getMethod, invoke, and field access to detect code that may break during refactoring.

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?

With no annotations, the description carries the full burden. It explains the detected calls and why they are important, but does not disclose side effects, error conditions, or whether the tool is read-only. The output is described as 'grouped by method type' but no further details.

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 concise with a clear usage example and bulleted list of detected calls. It avoids unnecessary details but remains informative.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description attempts to describe the output. It includes prerequisites and rationale, but lacks details on return format, error handling, and parameter usage.

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 does not mention the `maxResults` parameter or its default value, adding no value beyond the 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?

The description clearly states 'Find places where Java reflection API is used,' lists specific reflection calls detected, and differentiates from sibling tools like `find_references` by focusing on reflection usage.

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 a usage example and notes the prerequisite (`Requires load_project to be called first`). Also explains when to use this tool (reflection calls invisible to static searches). However, it does not explicitly mention the `maxResults` parameter or when not to use the tool.

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