Skip to main content
Glama

analyze_code_complexity

Measure cyclomatic complexity across a codebase using quick (100-file) or deep (1000-file) scans to identify high-risk functions and prioritize refactoring.

Instructions

Analyze cyclomatic complexity. mode='quick' (100 files) or 'deep' (1000).

Input Schema

NameRequiredDescriptionDefault
modeNoquick
target_pathNo.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.12.0

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses the per-mode file caps, which is a genuine behavioral limit, but says nothing about whether the scan is read-only, cost/latency implications of 'deep', or how the analysis behaves on very large repositories.

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?

Two short sentences, front-loaded with the purpose and followed immediately by the mode distinction. Nothing is wasted, though the terseness borders on under-specification rather than crisp brevity.

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

Completeness2/5

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

An output schema exists, so return values need not be explained. However, with no annotations, 0% schema coverage on a 2-param tool, and an unmentioned target_path, the definition leaves an agent guessing about the second parameter and about cost/safety behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It does explain 'mode' meaningfully (quick=100 files, deep=1000), well beyond the bare string schema. But 'target_path' is never mentioned, and what the file numbers mean (files scanned vs sampled) is left ambiguous.

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?

States a specific verb and analysis target ('Analyze cyclomatic complexity'), so the resource is unambiguous. It does not differentiate itself from close siblings such as analyze_code_quality or analyze_project_structure, which keeps it below a 5.

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

Usage Guidelines3/5

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

The two modes imply a usage choice (quick for breadth 100 files, deep for up to 1000), which is useful guidance. However, there is no statement of when to prefer this tool over analyze_code_quality or when not to use it, and no prerequisites are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.