Skip to main content
Glama

extract_interface

Extract an interface from a Java class by selecting public methods. Generates the interface file and adds an implements clause to the original class.

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
lineYesZero-based line number of class declaration
interfaceNameYesName for the new interface
methodNamesNoSpecific method names to include (default: all public non-static methods)
filePathYesPath to source file containing the class
columnYesZero-based column number
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses key behaviors: it returns both the interface file text and edits to modify the original class. It also notes zero-based coordinates and the load_project prerequisite. However, it does not detail side effects, error handling, or permission requirements, which would push it to 5.

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 moderately concise with clear sections (purpose, output, usage, important note). It front-loads the core purpose and then adds necessary details. Every sentence serves a purpose. Minor improvement could be merging the empty lines for tighter structure.

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 5 parameters and no output schema, the description adequately explains the return value (interface file text and edits) and prerequisites. It covers default behavior for methodNames and zero-based coordinates. It does not detail the exact structure of the returned edits or error conditions, but it is sufficient for typical usage.

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?

With 100% schema description coverage, the baseline is 3. The description does not add significant meaning beyond what the schema already provides for parameters. It reiterates that methodNames is optional and defaults to all public non-static methods, but that information is already in the schema's description.

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 extracts an interface from a class containing selected public methods. It specifies the action (extract), resource (interface from a class), and output (new interface file text and edits to add 'implements' clause). This distinguishes it from sibling refactoring tools like extract_method or extract_constant.

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 instructions: position on class, provide interface name, optionally specify methods. It notes zero-based coordinates and the prerequisite to call load_project first. While it gives good context, it does not explicitly state when not to use this tool or name alternatives, so it loses one point.

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