Skip to main content
Glama

get_inheritance_chain

Returns the inheritance chain of a C++ class or struct, including bases and derived with access and virtual flags. Optionally traverse full hierarchy.

Instructions

Read-only. Return the C++ inheritance chain for a class or struct.

Shows direct base classes (what this inherits from) and direct derived classes (what inherits from this), along with access level and virtual flag for each edge.

When transitive=True, walks the full hierarchy up to all ancestors and down to all descendants (bounded by max_depth). Uses BFS with cycle detection to handle diamond inheritance.

Returns: dict: { name, qualified_name, kind, file, line, bases: [{name, usr, access, is_virtual, file}], derived: [{name, usr, access, is_virtual, file}], all_bases: [...] (when transitive=True, ancestors sorted by depth), all_derived: [...] (when transitive=True, descendants sorted by depth) }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_depthNoMaximum BFS depth for transitive walk (default 10).
class_nameYesClass or struct name to get inheritance information for. E.g. 'UART_DRIVER' or 'zbox::ZMODEM'.
transitiveNoWhen True, walk the full inheritance tree both up (ancestors) and down (descendants). Default: False (direct bases and derived only).
project_rootNoProject root. Auto-detected if omitted.
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses key behaviors: read-only, BFS with cycle detection for transitive traversal, bounded by max_depth, and returns a structured dict. This adds transparency beyond the 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 concise (~10 lines) and well-structured: purpose first, then parameter behavior, then return format. Every sentence adds value; no redundancy.

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?

The tool has 4 parameters (all documented) and no output schema. The description provides a detailed return format with fields, handles complexity like transitive walks and cycle detection, and covers edge cases (diamond inheritance). It is complete for an experienced user.

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 coverage is 100% and each parameter has a description. The description adds context like 'BFS' and 'diamond inheritance', and clarifies the effect of transitive=True. Baseline is 3, and the description provides modest added value.

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 purpose: 'Return the C++ inheritance chain for a class or struct.' It uses a specific verb ('Return') and resource ('C++ inheritance chain'), and the tool is distinct from siblings like get_class_members or find_references.

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 explains when to use transitive=True and max_depth, and notes it is read-only. It does not explicitly list alternatives or situations to avoid, but the context is clear and sufficient for an experienced user.

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