Skip to main content
Glama

get_document_symbols

Retrieve all symbols in a Java source file as a hierarchical list of types, methods, fields, and nested types, with locations, kinds, and modifiers.

Instructions

Get all symbols (types, methods, fields) in a source file.

USAGE: Provide a file path to get all symbols in that file OUTPUT: Hierarchical list of all types, methods, fields, and nested types

Returns symbols with their locations, kinds, and modifiers. A record's components are listed as its first children.

Types are listed as declared at top level and as members of other types. Local and anonymous classes, those declared in method, field or initializer bodies, are not listed.

maxResults outside 0 to 2000 is INVALID_PARAMETER.

Requires load_project to be called first.

Input Schema

NameRequiredDescriptionDefault
filePathYesPath to source file
maxResultsNoMaximum symbols to return, 0 to 2000 (default 500)
includePrivateNoInclude private members (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.5.3
    • changedInput schema / properties / maxResults / description
      Previous value: -"Maximum symbols to return (default 500)"New value: +"Maximum symbols to return, 0 to 2000 (default 500)"
  2. Addedv1.3.4
  3. Removedv1.3.3
  4. First observedv1.2.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses output shape (hierarchical), edge-case filtering (local/anonymous classes excluded, record components as first children), and the error behavior for out-of-range maxResults (INVALID_PARAMETER). It does not state cost/latency or behavior for a nonexistent file path, keeping it from a 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?

Front-loads the purpose, then uses USAGE/OUTPUT labels for scannability, and every sentence (including the local-class exclusion) carries real information. Slightly fragmented line breaks and some redundant restatement of return contents keep it from a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description explains the return structure, nesting, and what is deliberately omitted, plus the load_project precondition. For a 3-parameter read tool, an agent has everything needed to call it correctly.

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 filePath, maxResults and includePrivate are already fully documented. The description's mention of the maxResults valid range and INVALID_PARAMETER outcome largely restates the schema, and it never mentions includePrivate — baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Get all symbols') plus the concrete contents (types, methods, fields) and scoping ('in a source file'). This lets an agent distinguish it from project-wide siblings like search_symbols, though no sibling is named explicitly.

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?

Gives a clear usage line ('Provide a file path to get all symbols in that file') and, importantly, a hard prerequisite ('Requires load_project to be called first'). It stops short of naming alternatives such as search_symbols for cross-file lookups, so no exclusions are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.