Skip to main content
Glama

complexity_analysis

Analyze code complexity to identify code smells and prioritize refactoring opportunities.

Instructions

šŸ“Š Analyze code complexity and identify refactoring opportunities.

šŸŽÆ PURPOSE: Calculates cyclomatic complexity, identifies code smells, and suggests specific refactoring opportunities with priority rankings. šŸ”§ USAGE: Use after basic analysis to identify problematic code areas that need attention. Essential for code quality assessment. ⚔ PERFORMANCE: Moderate operation (5-15s) - analyzes complexity metrics across the entire codebase. šŸ”„ WORKFLOW: analyze_codebase → complexity_analysis → examine high-complexity functions → find_callers/find_callees for refactoring impact. šŸ’” TIP: Start with threshold=15 for critical issues, lower to 10 for comprehensive analysis. Focus on functions with complexity >20 first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thresholdNoMinimum complexity threshold to report (10=comprehensive, 15=critical issues only, 20=severe problems)
Behavior4/5

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

With no annotations, the description carries the behavioral disclosure burden. It includes performance characteristics ('Moderate operation (5-15s)'), scope ('across the entire codebase'), and output nature ('priority rankings'). It doesn't explicitly state it is read-only, but as an analysis tool this is implied, and the added performance/scope context goes beyond a basic statement.

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 well-structured with short labeled sections (PURPOSE, USAGE, PERFORMANCE, WORKFLOW, TIP) and a front-loaded summary sentence. Every sentence contributes actionable information, with no wasted words or 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?

Despite having only one parameter and no output schema, the description covers all necessary aspects: purpose, usage context, performance, workflow integration with siblings, and parameter tips. It is complete enough for an agent to select and invoke the tool correctly without additional context.

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 schema already includes full descriptions of the single 'threshold' parameter with ranges. The description's TIP adds strategic guidance on how to choose thresholds (e.g., 'Start with threshold=15 for critical issues, lower to 10 for comprehensive analysis'), which provides practical value beyond the schema.

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 what the tool does: calculates cyclomatic complexity, identifies code smells, and suggests refactoring opportunities with priority rankings. The PURPOSE section is specific and distinguishes it from siblings like analyze_codebase by emphasizing deeper complexity analysis.

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 USAGE section explicitly says 'Use after basic analysis' and provides a workflow (analyze_codebase → complexity_analysis → examine high-complexity functions → find_callers/find_callees), giving clear positioning relative to sibling tools. It also states it is 'Essential for code quality assessment,' making the when-to-use unambiguous.

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/entrepeneur4lyf/code-graph-mcp'

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