Skip to main content
Glama

detect_antipatterns

Read-onlyIdempotent

Detect performance and design antipatterns in code: N+1 queries, missing indexes, god classes, and more. Returns categorized findings with severity and suggestions.

Instructions

Detect performance & design antipatterns: N+1 query risks, missing eager loading, unbounded queries, event listener leaks (via callSites — framework-managed listeners like Livewire/Socket.IO/NestJS gateways/Mongoose/Sequelize hooks are excluded), circular ORM association cycles, missing FK indexes, memory leaks (unbounded caches, closure-captured growing collections), god classes (>=25 methods or >=500 LOC), long methods (>=60 LOC), long parameter lists (>=6 params), deep nesting (>=5 indent levels). ORM-scoped signals require an active ORM plugin; size/complexity detectors (god_class, long_method, long_parameter_list, deep_nesting) run on every indexed symbol. For ES/CJS import cycles use get_circular_imports. For code quality (TODOs, debug artifacts, hardcoded values) use scan_code_smells. For security use scan_security. Read-only. Returns JSON: { findings: [{ category, severity, file, line, message, suggestion }], total }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax findings to return (default: 100)
categoryNoAntipattern categories to check (default: all)
file_patternNoFilter to files matching this pattern
output_formatNoOutput format. "json" (default) returns the native finding shape; "sarif" emits a SARIF 2.1.0 log for code-scanning ingestion.
severity_thresholdNoMinimum severity to report (default: low)
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true. The description adds value by confirming read-only behavior, detailing the return shape (JSON with findings array), and explaining ORM plugin dependency. No contradictions with annotations.

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?

The description is dense but well-structured. It front-loads the purpose and then provides detailed antipattern conditions and usage notes. Every sentence adds value. However, it is slightly long; a minor restructure could improve readability without losing information.

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 the complexity of detecting 11 antipattern categories with various conditions, the description is highly complete. It covers prerequisites, filter options, output format, and fallback alternatives. No output schema exists, so the description adequately explains the return structure.

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 100%, so parameters are well-documented in the schema. The description adds context beyond the schema: it explains default values (limit default 100, all categories), lists categories in prose, and elaborates on the output_format semantics ('json' vs 'sarif'). This enriches the agent's understanding.

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 detects performance & design antipatterns and lists specific categories. It distinguishes from siblings by explicitly naming alternative tools for related tasks (e.g., get_circular_imports for import cycles, scan_code_smells for code quality, scan_security for security).

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?

The description provides explicit usage guidance: when to use this tool vs alternatives, preconditions (ORM plugin required for certain signals), and scope of detectors. It also explains which detectors always run. This gives the agent clear decision criteria.

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/nikolai-vysotskyi/trace-mcp'

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