Skip to main content
Glama

Get File or Directory Structural Outline

get_file_outline
Read-onlyIdempotent

Extract a structural AST outline of a file or directory, including types, functions, members, and line ranges, without reading raw source. Inspect structure before fetching code ranges.

Instructions

Extract the structural AST outline of a single source file (declared types, functions, members, and 1-based line ranges) or a directory (immediate subfolders, files, line counts, and top-level symbols) without reading raw source text. Use to inspect file or folder structure before fetching code ranges; to read actual source lines use fetch_code_snippets, and to search declarations across the workspace by name use find_symbol. Queries the indexed .codeexplorer/graph.db (switching output shape automatically based on whether filePath resolves to a file or directory, with '.' targeting the workspace root) and returns YAML symbol trees or folder summaries without truncating large files.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "filePath": "<filePath>"
    },
    "name": "get_file_outline"
  }
}

Input Schema

NameRequiredDescriptionDefault
filePathYesRequired file or directory path to outline (workspace-relative path, absolute path, or '.' for the workspace root).
workspacePathNoOptional absolute path to the target workspace root directory. Omit to use the bound workspace, active client root, or sticky session workspace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.85.1
    • changedInput schema / properties / filePath / description
      Previous value: -"File or directory path (workspace-relative or absolute, or '.' for workspace root)."New value: +"Required file or directory path to outline (workspace-relative path, absolute path, or '.' for the workspace root)."
    • changedInput schema / properties / workspacePath / description
      Previous value: -"Optional workspace root path."New value: +"Optional absolute path to the target workspace root directory. Omit to use the bound workspace, active client root, or sticky session workspace."
  2. Changed1 schema field changedv1.85.0
    • changedInput schema / properties / filePath / description
      Previous value: -"File path relative to workspace or absolute."New value: +"File or directory path (workspace-relative or absolute, or '.' for workspace root)."
  3. First observedv1.80.5

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, non-destructive, closed-world behavior. The description adds genuinely new traits: it queries the indexed .codeexplorer/graph.db, switches output shape automatically based on whether filePath resolves to a file or directory, treats '.' as workspace root, and does not truncate large files. That last point is a useful behavioral guarantee; only minor gaps remain (e.g., staleness of the index, error behavior on unresolved paths).

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?

Purpose is front-loaded, followed by usage routing and behavioral detail in a logical order with no filler sentences. It is dense—two long sentences—but every clause carries information an agent would otherwise have to discover empirically.

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?

There is no output schema, but the description compensates by naming the return format (YAML symbol trees or folder summaries) and the no-truncation guarantee. Combined with fully documented parameters and annotations, nothing an agent needs to invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds meaning beyond the schema: filePath's file-vs-directory resolution determines the output shape, and '.' targets the workspace root. The workspacePath fallback chain is left to the schema, which already documents it, so this is a modest but real addition.

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?

States a specific verb and resource: 'Extract the structural AST outline' of a file (types, functions, members, line ranges) or directory (subfolders, files, line counts, top-level symbols). The dual file/directory scope is spelled out concretely, so an agent can distinguish it from find_symbol or fetch_code_snippets without inspecting either schema.

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 gives when-to-use ('inspect file or folder structure before fetching code ranges') and names two alternatives with the conditions that select them: fetch_code_snippets for raw source lines, find_symbol for cross-workspace name search. No inference required.

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