Skip to main content
Glama

inline_variable

Inline local variables in Java code by replacing variable usages with their initializer expressions, generating text edits for refactoring while ensuring safety by checking for modifications after initialization.

Instructions

Inline a local variable by replacing all usages with its initializer expression.

Returns the text edits needed to inline the variable. The caller should apply these edits to perform the inlining.

USAGE: Position cursor on variable declaration or usage OUTPUT: Edits to delete declaration and replace usages with initializer

IMPORTANT: Uses ZERO-BASED coordinates. SAFETY: Will refuse if variable is modified after initialization.

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to source file
lineYesZero-based line number of variable declaration or usage
columnYesZero-based column number
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 behaviors: the tool returns text edits rather than applying them directly, uses zero-based coordinates, refuses if the variable is modified after initialization, and requires a prior project load. This covers safety, output format, and prerequisites well, though it could mention error handling or performance aspects.

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 and front-loaded, starting with the core purpose. Each sentence adds value, such as usage instructions, output details, and safety notes. It's slightly verbose with separate lines for some points, but overall efficient and clear without wasted words.

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 complexity (refactoring operation with safety checks) and lack of annotations or output schema, the description does a good job covering purpose, usage, behavior, and prerequisites. It explains the output format ('Returns the text edits') and safety constraints, though it could briefly note what the edits look like or error cases for full completeness.

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 description coverage is 100%, so the schema already documents all parameters (filePath, line, column). The description adds context by explaining these are 'Zero-based coordinates' and relate to 'variable declaration or usage,' but doesn't provide additional syntax or format details beyond what the schema offers. This meets the baseline for high schema coverage.

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 a specific verb ('Inline') and resource ('local variable'), explaining it replaces usages with the initializer expression. It distinguishes from siblings like 'extract_variable' (which does the opposite) and 'inline_method' (which handles methods rather than variables).

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: 'Position cursor on variable declaration or usage' and 'Requires load_project to be called first.' It also implicitly distinguishes from alternatives by specifying the tool's scope (local variables only) and safety constraints, helping users know when to use it versus other refactoring tools.

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