Skip to main content
Glama

roslyn:get_complexity_metrics

Analyze code complexity metrics for C# methods or files to identify maintainability issues. Provides cyclomatic complexity, nesting depth, lines of code, parameter count, and cognitive complexity measurements.

Instructions

Get complexity metrics for a method or entire file.

METRICS: cyclomatic (decision points), nesting (max depth), loc (lines), parameters (count), cognitive (Sonar-style) USAGE: get_complexity_metrics(filePath) for file, or add line/column for specific method OUTPUT: Per-method breakdown with all requested metrics IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to source file
lineNoOptional: zero-based line for specific method
columnNoOptional: zero-based column
metricsNoOptional: specific metrics [cyclomatic, nesting, loc, parameters, cognitive]
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: the tool returns 'Per-method breakdown with all requested metrics', specifies that coordinates are 'ZERO-BASED', and lists the available metrics. It does not cover aspects like error handling, performance, or permissions, but provides sufficient operational context for a read-only analysis tool.

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 clear sections (purpose, metrics, usage, output, important note), uses bullet-like formatting for readability, and contains no redundant information. Every sentence serves a distinct purpose, making it efficient and easy to parse.

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?

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description provides strong context: it explains what metrics are available, how to target methods vs. files, and the zero-based coordinate system. It lacks details on output format structure or error cases, but is largely complete for an analysis tool without annotations.

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 parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'zero-based coordinates' and listing metric types, but does not provide additional syntax, examples, or constraints. This meets the baseline for high schema coverage.

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 verb ('Get') and resource ('complexity metrics') with specific scope ('for a method or entire file'). It distinguishes from siblings by focusing on complexity metrics rather than analysis, refactoring, or other code operations, making its purpose unambiguous.

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?

The description provides explicit usage instructions ('get_complexity_metrics(filePath) for file, or add line/column for specific method'), which clarifies when to use different parameter combinations. However, it does not mention when to choose this tool over alternative analysis tools like 'analyze_method' or 'analyze_control_flow', leaving some sibling differentiation incomplete.

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/pzalutski-pixel/sharplens-mcp'

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