Skip to main content
Glama
timohaa

Scopewalker MCP

by timohaa

Complexity Metrics

get_complexity_metrics
Read-onlyIdempotent

Measure code complexity across files or directories, returning per-function nesting, cyclomatic, and cognitive metrics. Control output with limit or summary_only.

Instructions

Returns complexity metrics (nesting, params, cognitive, per-function cyclomatic). Use limit/summary_only to control output.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile or directory to analyze; must be inside the allowed roots
limitNoMax files returned, most complex first (default 20)
max_depthNoMax directory depth to descend (default unlimited)
max_filesNoStop after scanning this many files (default unlimited)
extensionsNoOnly scan these extensions, e.g. [".ts", ".py"] (default all supported)
summary_onlyNoReturn summary totals without per-item details (default false)
include_hiddenNoInclude dotfiles and dot-directories (default false)
ignore_patternsNoExtra gitignore-style patterns to exclude, relative to path

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
_metaNo
filesYes
summaryYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv1.4.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / extensions / description
      Previous value: -"Filter by extensions"New value: +"Only scan these extensions, e.g. [\".ts\", \".py\"] (default all supported)"
    • changedInput schema / properties / ignore_patterns / description
      Previous value: -"Exclude patterns"New value: +"Extra gitignore-style patterns to exclude, relative to path"
    • changedInput schema / properties / include_hidden / description
      Previous value: -"Include hidden"New value: +"Include dotfiles and dot-directories (default false)"
    • changedInput schema / properties / limit / description
      Previous value: -"Max results"New value: +"Max files returned, most complex first (default 20)"
    • changedInput schema / properties / max_depth / description
      Previous value: -"Max depth"New value: +"Max directory depth to descend (default unlimited)"
    • changedInput schema / properties / max_files / description
      Previous value: -"Max files to scan"New value: +"Stop after scanning this many files (default unlimited)"
    • changedInput schema / properties / path / description
      Previous value: -"Target path"New value: +"File or directory to analyze; must be inside the allowed roots"
    • changedInput schema / properties / summary_only / description
      Previous value: -"Summary only"New value: +"Return summary totals without per-item details (default false)"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "_meta": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "funding": {
      +          "type": "string"
      +        },
      +        "item_count": {
      +          "type": "number"
      +        },
      +        "response_size_chars": {
      +          "type": "number"
      +        },
      +        "warning": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "item_count",
      +        "response_size_chars",
      +        "funding"
      +      ],
      +      "type": "object"
      +    },
      +    "files": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "functions": {
      +            "items": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "cognitive_complexity": {
      +                  "type": "number"
      +                },
      +                "cyclomatic_complexity": {
      +                  "type": "number"
      +                },
      +                "line": {
      +                  "type": "number"
      +                },
      +                "name": {
      +                  "type": "string"
      +                },
      +                "nesting_depth": {
      +                  "type": "number"
      +                },
      +                "severity": {
      +                  "enum": [
      +                    "high",
      +                    "extreme"
      +                  ],
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "name",
      +                "line",
      +                "cyclomatic_complexity",
      +                "cognitive_complexity",
      +                "nesting_depth",
      +                "severity"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "hotspots": {
      +            "items": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "function": {
      +                  "type": "string"
      +                },
      +                "issue": {
      +                  "type": "string"
      +                },
      +                "line": {
      +                  "type": "number"
      +                },
      +                "recommendation": {
      +                  "type": "string"
      +                },
      +                "value": {
      +                  "type": "number"
      +                }
      +              },
      +              "required": [
      +                "function",
      +                "line",
      +                "issue",
      +                "value",
      +                "recommendation"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "metrics": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "avg_cyclomatic_complexity": {
      +                "type": "number"
      +              },
      +              "avg_nesting_depth": {
      +                "type": "number"
      +              },
      +              "avg_parameters": {
      +                "type": "number"
      +              },
      +              "cognitive_complexity": {
      +                "type": "number"
      +              },
      +              "dependency_count": {
      +                "type": "number"
      +              },
      +              "function_count": {
      +                "type": "number"
      +              },
      +              "max_cognitive_complexity": {
      +                "type": "number"
      +              },
      +              "max_cyclomatic_complexity": {
      +                "type": "number"
      +              },
      +              "max_nesting_depth": {
      +                "type": "number"
      +              },
      +              "max_parameters": {
      +                "type": "number"
      +              }
      +            },
      +            "required": [
      +              "max_nesting_depth",
      +              "avg_nesting_depth",
      +              "max_parameters",
      +              "avg_parameters",
      +              "dependency_count",
      +              "cognitive_complexity",
      +              "function_count",
      +              "max_cyclomatic_complexity",
      +              "avg_cyclomatic_complexity",
      +              "max_cognitive_complexity"
      +            ],
      +            "type": "object"
      +          },
      +          "path": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "path",
      +          "metrics",
      +          "functions",
      +          "hotspots"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "path": {
      +      "type": "string"
      +    },
      +    "summary": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "files_analyzed": {
      +          "type": "number"
      +        },
      +        "high_complexity_files": {
      +          "type": "number"
      +        },
      +        "high_complexity_functions": {
      +          "type": "number"
      +        },
      +        "most_complex_file": {
      +          "anyOf": [
      +            {
      +              "additionalProperties": false,
      +              "properties": {
      +                "cognitive_complexity": {
      +                  "type": "number"
      +                },
      +                "path": {
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "path",
      +                "cognitive_complexity"
      +              ],
      +              "type": "object"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ]
      +        },
      +        "most_complex_function": {
      +          "anyOf": [
      +            {
      +              "additionalProperties": false,
      +              "properties": {
      +                "cyclomatic_complexity": {
      +                  "type": "number"
      +                },
      +                "function": {
      +                  "type": "string"
      +                },
      +                "line": {
      +                  "type": "number"
      +                },
      +                "path": {
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "path",
      +                "function",
      +                "line",
      +                "cyclomatic_complexity"
      +              ],
      +              "type": "object"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ]
      +        },
      +        "total_hotspots": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "files_analyzed",
      +        "high_complexity_files",
      +        "high_complexity_functions",
      +        "total_hotspots",
      +        "most_complex_file",
      +        "most_complex_function"
      +      ],
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "path",
      +    "files",
      +    "summary"
      +  ],
      +  "type": "object"
      +}
  2. Changed8 schema fields changedv1.3.0
    • addedInput schema / properties / extensions / items / maxLength
      Added value: +32
    • addedInput schema / properties / extensions / items / pattern
      Added value: +"^\\.?[A-Za-z0-9_+-]+$"
    • addedInput schema / properties / extensions / maxItems
      Added value: +100
    • addedInput schema / properties / ignore_patterns / items / maxLength
      Added value: +512
    • addedInput schema / properties / ignore_patterns / maxItems
      Added value: +100
    • changedInput schema / properties / limit / maximum
      Previous value: -9007199254740991New value: +5000
    • changedInput schema / properties / max_depth / maximum
      Previous value: -9007199254740991New value: +64
    • changedInput schema / properties / max_files / maximum
      Previous value: -9007199254740991New value: +10000
  3. Changed1 schema field changedv1.0.5
    • removedInput schema / properties / metrics
      Removed value: -{
      -  "description": "Metrics to calculate",
      -  "items": {
      -    "enum": [
      -      "nesting_depth",
      -      "parameters",
      -      "dependencies",
      -      "cognitive"
      -    ],
      -    "type": "string"
      -  },
      -  "type": "array"
      -}
  4. First observedv1.0.4

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so the safety profile is covered and the description does not contradict it. The description adds useful domain content by naming the metric families computed, but says nothing about scan cost, timeout behavior, or ordering semantics beyond what the schema already documents.

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 tight sentences with the core purpose front-loaded and no filler. The second sentence trades some terseness for usefulness, though it would earn its place better if it addressed when to use the tool rather than only how to shrink output.

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

Completeness3/5

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

With an output schema available and annotations carrying the safety profile, the definition is not required to explain return values, and it correctly lists computed metrics. However, for a tool among nine analysis siblings with no usage routing, the description leaves the agent guessing about when this is the right choice and what the metric values mean in practice.

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 every parameter including path, max_depth, max_files, extensions and ignore_patterns is already documented in the schema. The description's mention of limit/summary_only repeats schema information without adding format, default, or interaction details, so the baseline 3 applies.

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 ('Returns') and resource ('complexity metrics') and enumerates the metric kinds (nesting, params, cognitive, per-function cyclomatic), which meaningfully separates it from siblings like get_line_counts and get_code_smells. It stops short of naming a sibling explicitly, so differentiation is inferential rather than stated.

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

Usage Guidelines2/5

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

The only guidance is 'Use limit/summary_only to control output,' which is parameter advice, not when-to-use guidance. There is no indication of when to reach for this tool over check_thresholds or get_code_smells, nor any stated prerequisites despite the path being constrained to allowed roots.

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