Skip to main content
Glama

get_file_map

Get a structural overview of C/C++ files by listing all symbols—functions, classes, enums—grouped by kind, with counts and optional signatures, to orient before reading.

Instructions

Fast structural map of all C/C++ symbols in a file grouped by kind — libclang-powered table of contents. Like a table of contents before reading a chapter: see what functions, classes, and enums a file defines at a glance.

Paths are validated against the project root before read — :func:_validate_path_in_root ensures resolved paths stay within bounds.

Pass a path relative to the project root (src/main.cpp) or just the filename (main.cpp). Returns symbols keyed by kind (function, method, class, struct, enum, ...). Each kind has count (total) and items (first N, default 30). Set max_per_kind=0 for unlimited, signatures=true for full sigs.

Enum constants (enum_constant) are grouped into subgroups by parent enum. Each subgroup has name, count, and constants (list of {name, qualified_name, line, enum_value}). The subgroup count reflects the real total even when max_per_kind limits the constants list.

For detailed symbol information use get_symbol_context or lookup_symbol.

Read-only. No side effects. Use before reading a large file to orient yourself — see what functions, classes, and enums it defines.

Args: file_path: Path relative to project root, or just the filename. project_root: Project directory. Auto-detected if omitted. signatures: Include full function signatures. Default: False. max_per_kind: Max items per kind group (default 30, 0 = unlimited).

Returns: dict: {file, total_symbols, symbols: {kind: {count, items[], subgroups?[]}}}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageNoSysbuild image name within the variant (multi-project). Omit for all images of the variant.
variantNoBuild variant name (multi-project). Omit to use default_variant or fail-closed. Use '*' for all variants.
file_pathYesPath to source file — relative to project root or just filename.
signaturesNoInclude full function signatures in output.
max_per_kindNoMax items per symbol kind group (default 30, 0 = unlimited).
project_rootNoProject root. Auto-detected if omitted.
Behavior5/5

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

No annotations are provided, so the description carries full responsibility. It explicitly states 'Read-only. No side effects.' and describes path validation behavior with a specific function. It also details output limits and grouping behavior, providing rich behavioral context beyond basic operation.

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 well-structured: starts with an analogy, then covers validation, parameters, output details, and alternatives. Every sentence carries informational weight; no fluff. The use of paragraphs and an Args/Returns section makes it easy to parse.

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?

Given no output schema, the description provides a thorough explanation of the return dict structure, including enum subgroups and counting behavior. It also covers path validation, parameter nuances, and usage context. This is a complete standalone description for a moderately complex tool.

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

Parameters5/5

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

While the schema already covers parameters at 100%, the description adds meaningful semantics: explains file_path can be relative or just filename, project_root auto-detection, max_per_kind behavior (0 = unlimited), and the return structure with counts and subgroups. This goes beyond the schema by clarifying practical usage and output details.

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's function: 'Fast structural map of all C/C++ symbols in a file grouped by kind' with a helpful analogy. It distinguishes itself from siblings by focusing on a high-level structural overview, explicitly contrasting with get_symbol_context/lookup_symbol for detailed info.

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?

Provides explicit when-to-use guidance: 'Use before reading a large file to orient yourself.' It also names alternatives: 'For detailed symbol information use get_symbol_context or lookup_symbol.' This clearly directs an agent to the appropriate tool for different needs.

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/turbyho/fw-context-mcp'

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