Skip to main content
Glama

extract_interface

Extract an interface from a Java class by selecting public methods. Generates a new interface file and modifies the original class to implement it.

Instructions

Extract an interface from a class containing selected public methods.

Returns the text for a new interface file and edits to add 'implements' clause to the original class.

USAGE: Position on class, provide interface name, optionally specify methods OUTPUT: Interface file content and class modification edit

IMPORTANT: Uses ZERO-BASED coordinates.

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnYesZero-based column number
filePathYesPath to source file containing the class
methodNamesNoSpecific method names to include (default: all public non-static methods)
interfaceNameYesName for the new interface
lineYesZero-based line number of class declaration
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 explains the tool's behavior: returns interface file content and class modification edit, uses zero-based coordinates, and has a prerequisite. However, it doesn't mention potential side effects, error conditions, or what happens if the class already implements an interface, 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 and appropriately sized, with key information front-loaded: purpose, usage, output, and important notes. Every sentence adds value, though the formatting with all-caps sections could be slightly refined for better readability.

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 the tool's complexity (5 parameters, no output schema, no annotations), the description is adequate but has gaps. It explains the tool's purpose, usage, and output format, but doesn't detail the return structure or potential edge cases. For a refactoring tool with multiple parameters, more completeness would be beneficial.

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 thoroughly. The description adds minimal value beyond the schema, mentioning 'optionally specify methods' which aligns with methodNames parameter but doesn't provide additional semantics. Baseline 3 is appropriate when schema does the heavy lifting.

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: extracting an interface from a class containing selected public methods. It specifies the verb ('extract'), resource ('interface from a class'), and distinguishes it from siblings like extract_method or extract_variable by focusing on interface creation rather than code extraction for refactoring.

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 clear context for usage: 'Position on class, provide interface name, optionally specify methods' and 'Requires load_project to be called first.' It gives practical guidance on prerequisites and how to invoke the tool, though it doesn't explicitly state when not to use it or name alternatives among siblings.

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