Skip to main content
Glama

find_unused_code

Detects unused private methods, fields, and write-only fields in Java code, supporting optional file-specific analysis.

Instructions

Find unused private methods and fields in the project.

USAGE: find_unused_code() USAGE: find_unused_code(filePath="path/to/File.java") OUTPUT: List of unused private members

Detects:

  • Unused private methods

  • Unused private fields

  • Write-only fields (set but never read)

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeMethodsNoInclude unused methods (default true)
filePathNoOptional: specific file to check (default: all files)
includeFieldsNoInclude unused fields (default true)
Behavior3/5

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

With no annotations, the description carries the burden of behavioral disclosure. It explains what is detected and that output is a list, but it does not explicitly state that the operation is read-only and non-destructive, nor does it mention any side effects or required permissions.

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 relatively concise (9 lines) and includes usage examples and a bullet list. However, the structure could be improved by grouping information more logically, but it remains clear and front-loaded.

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?

The description covers prerequisites and detection categories, but without an output schema, the return format is underspecified ('List of unused private members'). Details like line numbers, member names, or structure are missing, leaving the agent with incomplete information.

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 usage examples implying default values (e.g., 'includeMethods default true'), but does not provide additional meaning beyond what the schema already describes for each parameter.

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 unused private methods and fields, with specific detection categories listed (unused methods, fields, write-only fields). It distinguishes itself from siblings like find_references or find_field_writes by focusing on unused code detection.

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 usage examples and explicitly states the prerequisite 'Requires load_project to be called first.' It implies usage for code cleanup. However, it does not explicitly contrast with alternatives or specify when not to use, which would be helpful.

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