Skip to main content
Glama

find_dead_code

Find C/C++ functions defined but never called using libclang-based dead code detection. Identifies unused symbols that grep cannot distinguish, with support for vendor path exclusion.

Instructions

USE INSTEAD OF grep or manual code review. Find C/C++ functions that are defined but never called — libclang-powered dead code detection. grep cannot distinguish called from uncalled symbols across a codebase.

Returns two categories of results, each with a status field:

  • "dead" — no references at all (neither calls nor function pointer assignments). Likely unused.

  • "possibly_dead" — the function is assigned to a function pointer (Phase 1 ref_kind="indirect") but no call site through that pointer was resolved (Phase 3). This means the function MIGHT be called through unindexed code or a type-erased API. LLM should treat this as uncertain, not as confirmed dead code. Verify each hit with find_indirect_targets before deleting.

Expect additional false positives from constructors called via factories, ISRs, virtual method overrides, and weak-aliased symbols. Always verify before deleting.

By default, SDK/vendor paths are auto-excluded based on the build system (mbed-os/ for Mbed OS, .pio/ for PlatformIO, zephyr/ + build/

  • modules/ for Zephyr), and project config exclude_paths are applied. Use project_only=False to see all results including vendor code. Requires the reference index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum results (default 100).
project_onlyNoWhen True (default), auto-excludes SDK/vendor paths (mbed-os/%, .pio/%, zephyr/%, build/%) and applies project config exclude_paths. Set False to see all results.
project_rootNoProject root. Auto-detected if omitted.
exclude_pathsNoAdditional LIKE patterns to exclude. Merged with defaults from config. E.g. ['lib/%'].

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

No annotations provided, but description fully discloses behavior: result categories, false positives, auto-exclusion paths, and requirement for reference index. No destructive side effects mentioned.

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?

Well-structured with sections and bullet points, though somewhat lengthy. Every sentence adds value, but could be slightly more concise.

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?

Covers all necessary aspects: input parameters, result categories, false positives, usage guidance, and integration with other tools. Output schema exists so return values are documented separately.

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%, and description adds meaningful context for each parameter, e.g., explains auto-excluded paths for project_only and gives example for exclude_paths.

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?

Description explicitly states the tool finds C/C++ functions defined but never called, distinguishes from grep/manual review, and details two result categories with status fields.

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 advises using instead of grep/manual review, provides verification steps with find_indirect_targets, and lists common false positives to check before deleting.

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