Skip to main content
Glama

get_complexity_report

Read-onlyIdempotent

Identify complex code by retrieving cyclomatic complexity, nesting depth, and parameter counts for symbols in a file or across the project. Use before refactoring.

Instructions

Get complexity metrics (cyclomatic, max nesting, param count) for symbols in a file or across the project. Use to identify complex code before refactoring. For historical trends use get_complexity_trend instead. Read-only. Returns JSON: { symbols: [{ symbol_id, name, kind, file, line, cyclomatic, max_nesting, param_count }], total }. Set output_format: "toon" for lossless TOON encoding — cheaper LLM tokens on tabular payloads.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathNoFile path to report on (omit for project-wide top complex symbols)
min_cyclomaticNoMin cyclomatic complexity to include (default: 1 for file, 5 for project)
limitNoMax results (default: 30)
sort_byNoSort by metric (default: cyclomatic)
output_formatNoOutput format. "json" (default) returns JSON, "markdown" returns LLM-friendly fenced markdown (tool-specific), "toon" returns Token-Oriented Object Notation — 30-60% fewer tokens on tabular data, fully lossless.
Behavior5/5

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

Annotations declare readOnlyHint=true, destructiveHint=false, idempotentHint=true. Description reinforces read-only nature and adds details about output format options (JSON, markdown, TOON) with token savings, which goes beyond basic safety.

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 concise sentences with a structured note on output formats. No unnecessary words, all sentences earn their place.

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 5 parameters (all described in schema), no output schema, and rich sibling set, the description covers tool purpose, usage guidance, parameter defaults, output structure, and format options. Complete and self-contained.

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 coverage is 100%, so description does not need to repeat parameters. However, it adds helpful clarifications: default min_cyclomatic (1 for file, 5 for project), behavior when file_path is omitted, and explanation of output_format options. This adds moderate 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?

Clearly states it gets complexity metrics (cyclomatic, max nesting, param count) for symbols in a file or across the project. Distinguishes itself from sibling tool get_complexity_trend by noting that tool is for historical trends.

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

Usage Guidelines4/5

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

Explicitly says 'Use to identify complex code before refactoring' and points to an alternative for historical trends. Provides context but does not cover all possible use/non-use cases.

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