Skip to main content
Glama
gclluch
by gclluch

dead_code

Find unreferenced private and module-level symbols in Python code, with cross-file awareness and optional test file scanning to detect dead code.

Instructions

Find unreferenced private and module-level symbols across a directory.

If path is a file, its containing directory is scanned so that cross-file references are seen.

Args: path: A .py file or a directory. include_tests: Also scan test files (default False).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
include_testsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries the burden of behavioral disclosure. It reveals important non-obvious behavior: file paths expand to their containing directory, and cross-file references are considered. This goes beyond a simple 'find dead code' statement and gives meaningful insight into how the tool operates, though it could further clarify what counts as 'unreferenced' or 'private' (e.g., underscore convention).

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 compact and well-structured: a one-sentence purpose, a brief behavioral note, and an Args list. Every sentence adds value; there is no repetition of schema already present. The front-loaded purpose makes the tool's intent immediately clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema and moderate complexity, the description adequately covers the tool's purpose, path handling, and both parameters. It could further differentiate from sibling tools like code_smells or analyze_file, but all necessary operational details for invocation are present, so it is nearly complete.

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 description coverage is 0%, so the description must compensate. It does so with an Args block: 'path: A .py file or a directory' and 'include_tests: Also scan test files (default False).' This adds meaning beyond the raw schema, clarifying accepted path types and the purpose of the boolean flag, though it doesn't delve into edge cases or expected formats.

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 opens with 'Find unreferenced private and module-level symbols across a directory,' using a specific verb ('Find') and a well-defined resource ('unreferenced private and module-level symbols'). This clearly distinguishes it from siblings like find_usages or find_implementations, which target references and implementations rather than dead code.

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?

It provides clear usage context: 'If `path` is a file, its containing directory is scanned so that cross-file references are seen.' This explains the directory/file behavior and implies when to use the tool (for dead code analysis across files). It does not explicitly name alternatives or when not to use it, but the context is unambiguous enough for a 4.

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/gclluch/py-ast-mcp'

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