Skip to main content
Glama

get_health_score

Compute repository health from scan metrics and persist a timestamped history entry. Use when you need a 0-100 health score with breakdown and coverage caveats.

Instructions

Compute repository health from scan metrics and append a timestamped state entry. Use when: you need a before/after health metric and persisted history. Don't use when: you only need findings without writing state (use scan_repo instead).

Returns {score, coverage, breakdown, scan_summary}, plus caveat for limited coverage or parse failures. score is 0-100 (higher is healthier), or null when no files were analysed. coverage is the analysed fraction (0-1, three decimal places), not test coverage. Breakdown contains dead_code_ratio, duplicate_ratio (fractions rounded to three decimals), god_file_count and circular_count. Deductions cap at 30/30/20/20 points respectively; only Python/JS/TS-sensitive cycles reduce health. The history entry is appended on every call, so repeated calls are not idempotent.

Input Schema

NameRequiredDescriptionDefault
repo_pathYesExisting repository directory to scan and persist health_history in reforge-state.json; prefer an absolute path, e.g. /work/app. Every call appends a UTC-timestamped entry and rotates state backups.

Output Schema

NameRequiredDescriptionDefault
scoreYes
caveatNo
coverageYes
breakdownYes
scan_summaryYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.4.5
    • addedInput schema / properties / repo_path / description
      Added value: +"Existing repository directory to scan and persist health_history in reforge-state.json; prefer an absolute path, e.g. /work/app. Every call appends a UTC-timestamped entry and rotates state backups."
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / properties
      Added value: +{
      +  "breakdown": {
      +    "properties": {
      +      "circular_count": {
      +        "type": "integer"
      +      },
      +      "dead_code_ratio": {
      +        "type": "number"
      +      },
      +      "duplicate_ratio": {
      +        "type": "number"
      +      },
      +      "god_file_count": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "dead_code_ratio",
      +      "duplicate_ratio",
      +      "god_file_count",
      +      "circular_count"
      +    ],
      +    "type": "object"
      +  },
      +  "caveat": {
      +    "type": "string"
      +  },
      +  "coverage": {
      +    "type": "number"
      +  },
      +  "scan_summary": {
      +    "properties": {
      +      "imported_modules": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "languages_detected": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "parse_failures": {
      +        "type": "integer"
      +      },
      +      "total_classes": {
      +        "type": "integer"
      +      },
      +      "total_files": {
      +        "type": "integer"
      +      },
      +      "total_functions": {
      +        "type": "integer"
      +      },
      +      "total_imports": {
      +        "type": "integer"
      +      },
      +      "total_lines": {
      +        "type": "integer"
      +      },
      +      "unscanned_by_extension": {
      +        "additionalProperties": {
      +          "type": "integer"
      +        },
      +        "type": "object"
      +      },
      +      "unscanned_source_files": {
      +        "type": "integer"
      +      },
      +      "untracked_files_skipped": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "total_files",
      +      "total_functions",
      +      "total_lines",
      +      "languages_detected"
      +    ],
      +    "type": "object"
      +  },
      +  "score": {
      +    "anyOf": [
      +      {
      +        "type": "number"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ]
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "score",
      +  "coverage",
      +  "breakdown",
      +  "scan_summary"
      +]
  2. Addedv0.2.9

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, idempotentHint=false and destructiveHint=false, yet the description still adds real value: it states that a UTC-timestamped history entry is appended on every call, that repeated calls are therefore not idempotent, and that caveats appear for limited coverage or parse failures. It stops short of saying where state lives or how backups rotate, which only the parameter schema hints at.

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?

Purpose, when-to-use and when-not-to-use are front-loaded and tightly written. The trailing 'Returns {...}' block is informative but partly redundant with the existing output schema, making the definition longer than strictly necessary.

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 single-parameter tool with full annotation coverage and an output schema, the description covers the write side effect, side-effect caveats and scoring semantics well. The detailed return-value enumeration duplicates the output schema, so it is complete but not optimally scoped.

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% for the single parameter, and the schema description already covers path expectations, persistence to reforge-state.json and backup rotation. The description adds no parameter-level detail beyond what the schema supplies, so the baseline of 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 opening sentence names a specific verb and resource — computing repository health from scan metrics — and adds the persistence side effect. It explicitly differentiates from the sibling scan_repo, so an agent can pick between them without opening either schema.

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

Usage Guidelines5/5

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

Provides an explicit 'Use when' condition (need before/after metric plus persisted history) and an explicit 'Don't use when' that names the alternative (scan_repo for findings without writing state). Both directions of the routing decision are covered.

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