Skip to main content
Glama
gclluch
by gclluch

code_smells

Detect common Python code smells like long functions, deep nesting, god classes, and high complexity to improve maintainability.

Instructions

Detect long functions, deep nesting, god classes, too many parameters, mutable default arguments, mutable @dataclass field defaults, high complexity, bare excepts and shadowed builtins.

Args: path: Path to a .py file. function: Optional single function to analyse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
functionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations provided, the description carries the full burden for behavioral disclosure. It does enumerate the exact code smell categories and the scope (path or optional function), which is useful, but it does not mention whether the operation is read-only, what the return format is, or whether any side effects (e.g., file writes) occur. This is a moderate disclosure for a static analysis tool.

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 concise list of detectable smells followed by an Args section. Every sentence carries useful information, with no filler or redundancy, and the primary action is front-loaded.

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?

The description covers the input semantics and the scope of analysis, and the existence of an output schema means it does not need to detail return values. However, it does not mention whether a directory is accepted or how the optional function is resolved, leaving minor gaps that an agent might need to probe. Overall, it is sufficiently complete for the tool's complexity.

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?

The input schema provides no descriptions for its parameters (0% coverage), so the description must compensate. It does so by explaining that 'path' is a Python file and 'function' is an optional single function to analyze, adding meaningful semantic context beyond the raw parameter names. However, it could specify the expected format of the function parameter (e.g., name vs. qualified path), which prevents a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb 'Detect' and lists concrete code smell categories, making it clear what resource and action are involved. However, it does not explicitly distinguish itself from the sibling tool 'code_complexity' or other analyzer tools, so it falls short of a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives like 'code_complexity' or 'analyze_file'. The description implies it should be used for smell detection, but does not state prerequisites, exclusions, or preferred contexts, leaving the agent to infer usage from the parameter list.

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