Skip to main content
Glama

organize_imports

Organize Java file imports by removing unused statements and sorting remaining ones alphabetically to maintain clean, readable code structure.

Instructions

Organize imports in a Java file.

Removes unused imports and sorts remaining imports alphabetically. Returns the organized import block that should replace the existing imports.

USAGE: organize_imports(filePath="path/to/File.java") OUTPUT: Organized import statements and list of changes

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to source file
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool's actions (removing unused imports, sorting alphabetically) and output (organized import block, list of changes), which covers basic behavior. However, it lacks details on error handling, performance implications, or side effects like file modification, leaving some behavioral aspects unclear.

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 clear sections (purpose, usage, output, prerequisite) and uses bullet-like formatting for readability. It is appropriately sized with no redundant information, though the usage example could be integrated more seamlessly into the text.

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 moderate complexity (file transformation), no annotations, and no output schema, the description does a good job of covering key aspects: purpose, actions, output, and prerequisites. It could improve by detailing the output format more explicitly or mentioning error cases, but it provides sufficient context for basic use.

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?

The schema description coverage is 100%, with the parameter 'filePath' fully documented in the schema. The description adds minimal value by restating the parameter in the usage example ('filePath="path/to/File.java"'), but does not provide additional semantics beyond what the schema already specifies, such as format requirements or constraints.

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's purpose with specific verbs ('organize imports', 'removes unused imports', 'sorts remaining imports alphabetically') and identifies the resource ('Java file'). It distinguishes itself from sibling tools like 'analyze_file' or 'suggest_imports' by focusing on transformation rather than analysis or suggestion.

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 explicit usage context by stating 'Requires load_project to be called first', which is a clear prerequisite. However, it does not specify when to use this tool versus alternatives like 'suggest_imports' or other refactoring tools, nor does it mention any exclusions or edge cases.

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