Skip to main content
Glama

apply_quick_fix

Apply Java code fixes by ID to resolve issues like missing imports, exception handling, or method declarations in source files.

Instructions

Apply a fix by ID.

USAGE: apply_quick_fix(filePath="...", fixId="add_import:java.util.List") OUTPUT: Text edits to apply the fix

Fix ID formats:

  • add_import:{fullyQualifiedName} - Add an import statement

  • remove_import:{index} - Remove import at index

  • add_throws:{exceptionType} - Add throws declaration to method

  • surround_try_catch:{exceptionType} - Wrap statement in try-catch

IMPORTANT: Uses ZERO-BASED line numbers.

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to source file
lineNoZero-based line number (required for some fixes like add_throws)
fixIdYesThe fix ID from get_quick_fixes (e.g., 'add_import:java.util.List')
Behavior4/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 effectively describes key traits: it outputs 'Text edits to apply the fix' (clarifying the return type), specifies 'Uses ZERO-BASED line numbers' (important for parameter usage), and lists fix ID formats with examples (detailing operation types). However, it lacks information on error handling or side effects, preventing a perfect score.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose, followed by usage, output, formats, and prerequisites. Each sentence earns its place by providing essential information without redundancy, making it highly efficient and easy to parse.

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 complexity (a mutation tool with no annotations and no output schema), the description is largely complete. It covers purpose, usage, output type, parameter details, and prerequisites. However, it lacks explicit error handling or confirmation of changes, which could be beneficial for a tool that modifies files, preventing a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the baseline is 3. The description adds significant value by explaining fix ID formats with examples (e.g., 'add_import:java.util.List'), clarifying that 'line' is 'required for some fixes like add_throws', and providing usage examples. This goes beyond the schema's basic descriptions, though it doesn't cover all edge cases for parameters.

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 verb 'Apply' and the resource 'a fix by ID', making the purpose specific and clear. It distinguishes itself from sibling tools like 'get_quick_fixes' (which likely provides fixes) by focusing on application rather than retrieval, with no tautology or vagueness.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage instructions with an example and clearly states when to use it: 'Requires load_project to be called first.' It also implies when to use it by referencing 'get_quick_fixes' for obtaining fix IDs, offering clear context and prerequisites without misleading information.

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