Skip to main content
Glama

calculate_code_metrics

Analyze source files to compute Halstead volume, maintainability index, cyclomatic complexity, and SLOC density, providing objective code quality metrics for audits and maintenance decisions.

Instructions

Computes Halstead volume, maintainability index, cyclomatic complexity, and SLOC density metrics across source files. (0.01 USDC on Base L2)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payloadYesInput parameters or JSON string payload for the tool execution
paymentSignatureNoBase L2 USDC micropayment signature or transaction hash for x402 settlement

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden and does add one useful behavioral fact: the 0.01 USDC Base L2 cost. It also implies a read-only computation. However, it does not state what the response contains, whether payment is mandatory despite paymentSignature being optional, or any failure behavior.

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 a single compact sentence with no filler, and the concrete metric list is front-loaded. The parenthetical cost note is short and adds decision-relevant information rather than fluff.

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?

For a paid tool with a generic JSON-string payload and no output schema, the description leaves too much unspecified: how source files should be passed, what languages are supported, and what the return structure looks like. The cost disclosure is useful but does not fill these invocation gaps.

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 100%, so the baseline is 3. The description adds the notion that source files are the subject of the payload, which helps clarify the generic 'payload' field, but it gives no encoding or structure details 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?

The description opens with a specific verb ('Computes') and enumerates four concrete metric types, which unambiguously identifies the tool as a source-code analysis utility. The phrase 'across source files' clearly separates it from sibling financial, geometric, or syntax-validation tools.

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 provides no explicit when-to-use or when-not-to-use guidance, nor does it compare itself to alternatives like validate_code_syntax. The intended usage is only implied through 'source files' and the metric names, so an agent can infer context but is not directed.

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

Deploy Server

Other Tools