Skip to main content
Glama

analyze_file

Analyzes a Java source file to return file metadata, imports, types with member counts, and compilation diagnostics in a single call.

Instructions

Comprehensive file analysis in a single call.

USAGE: analyze_file(filePath="path/to/File.java") OUTPUT: File info, imports, types with member counts, diagnostics

Combines:

  • File info (path, package, line count)

  • All imports (with static/on-demand flags)

  • All types with member counts

  • Compilation diagnostics (errors/warnings)

Use this instead of multiple calls to get_document_symbols + get_diagnostics.

Requires load_project to be called first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to source file
includeMembersNoInclude full member details for each type (default false)
includeDiagnosticsNoInclude compilation errors/warnings (default true)
Behavior4/5

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

With no annotations, description bears full transparency burden. It describes tool's combined behavior and default for includeDiagnostics, but does not specify default for includeMembers (false) or any side effects. Minor gap, but overall satisfactory.

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?

Description is highly concise with clear sections (USAGE, OUTPUT, combines list, guideline). Every sentence serves a purpose, no wasted words, effectively front-loaded with key information.

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 complexity (combines multiple analyses) and no output schema, description provides sufficient overview of what is included. Minor missing detail on includeMembers default, but otherwise complete for selection and invocation.

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 covers 100% of parameters, so description adds minimal value beyond illustrating usage (e.g., filePath example). No additional semantics for includeMembers or includeDiagnostics beyond schema, meeting baseline.

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?

Description clearly states 'Comprehensive file analysis in a single call' and lists specific components (file info, imports, types with member counts, diagnostics), differentiating it from sibling tools that provide individual analyses.

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?

Explicitly states prerequisite 'Requires load_project to be called first' and recommends using this tool instead of multiple calls to get_document_symbols and get_diagnostics, providing clear context for when to use.

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