Skip to main content
Glama

List definitions in a file

list_definitions

Get a structural outline of source files: list classes, functions, methods, fields, and structs with their line ranges, enabling navigation without reading the entire file.

Instructions

List definitions (classes, functions, methods, fields, structs...) in a source file with name, kind and line ranges. Structural alternative to reading the whole file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesfile path
languageNooverride language inference
Install Server

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations, the description carries the behavioral disclosure burden. It discloses the output fields (name, kind, line ranges) and frames it as non-whole-file reading, but it does not mention language inference behavior, possible limitations, error cases, or how the tool determines definitions. This is adequate but not richly transparent.

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?

The description is two sentences, front-loading the core function and output details before adding the structural-alternative context. Every phrase earns its place, with no filler or repetition.

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?

For a simple list tool, the description is mostly complete: it states the resource, output shape, and purpose. However, it lacks context about language inference/override behavior, unsupported languages, and return format nuances. With no output schema, a bit more detail about how the tool behaves would make it fully complete.

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 parameters 'file' and 'language' are already documented in the schema. The description adds no extra parameter-level detail, such as the meaning of the language override or its enum values, which keeps it at the baseline of 3.

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 uses a specific verb ('List') and identifies exactly what is returned: definitions in a source file with name, kind, and line ranges. It also gives concrete examples (classes, functions, methods) and distinguishes itself as a structural alternative to reading the whole file, separating it from content-reading tools.

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 a clear usage context: use this tool to get a structural overview instead of reading the entire file. It does not explicitly enumerate exclusions or compare against sibling tools like ast_search or read_definition, but the intended scenario is reasonably clear.

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

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/zhaoxingxing06/kimi-tree-lens'

If you have feedback or need assistance with the MCP directory API, please join our Discord server