Skip to main content
Glama
neogeweb3

io.github.neogeweb3/code-health-suite

by neogeweb3

analyze_complexity

Analyze Python code complexity per function in files or directories, returning metrics like cyclomatic, cognitive, nesting depth, length, and letter grades. Sort and filter by complexity.

Instructions

Analyze Python code complexity for a file or directory. Returns per-function metrics: cyclomatic complexity (McCabe), cognitive complexity, nesting depth, function length, and letter grades (A-F).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNoReturn only top N functions by complexity. 0 = all.
pathYesFile or directory path to analyze.
sort_byNoSort metric (default: complexity).complexity
thresholdNoCyclomatic complexity threshold (default: 10).
Behavior4/5

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

No annotations are provided, so the description carries the full behavioral burden. It states what the tool returns (per-function metrics and grades) and implies a non-mutating analysis, which is useful. It does not discuss edge cases or limitations, but the read-only nature is reasonably clear from 'Analyze' and the output description.

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?

Two sentences, front-loaded with the core action and input scope, then a compact list of return metrics. Every word earns its place; no fluff or repetition of the schema.

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?

For a tool with 4 parameters, no annotations, and no output schema, the description is fairly complete: it defines the input scope and enumerates the return values. It does not describe return formatting or edge cases, but the listed metrics provide enough context for an agent to select and invoke the tool correctly.

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 description coverage is 100%, so the schema already documents all four parameters. The description adds context about what the metrics mean (cyclomatic, cognitive complexity, etc.), but it does not add parameter-specific semantics beyond what the schema provides. Baseline 3 applies.

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 analyzes Python code complexity for a file or directory and lists specific per-function metrics (cyclomatic, cognitive, nesting, length, grades). This distinguishes it from sibling tools like get_complexity_score or find_hotspots, which target summary scores or hotspot detection.

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 description gives clear target input context ('file or directory') and implies read-only analysis, but it does not explicitly say when to prefer this tool over siblings like get_complexity_score or find_hotspots. Usage context is implied rather than stated with alternatives or exclusions.

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/neogeweb3/code-health-suite'

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