Skip to main content
Glama

Rank a project's files by risk

scan_project

Rank JavaScript and TypeScript files in a directory by risk density to identify failure-prone code before review. Excludes test files by default; choose includeTests to rank them as well.

Instructions

Walk a directory and rank its JavaScript/TypeScript files by risk density — how concentrated the failure-prone code is, not how big the file is. Test files are left out by default; pass includeTests to rank them too. Deterministic and fast — no model call. Call this at the start of a code review to decide which files are worth your attention, instead of reading the tree in arbitrary order.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of files to return (default 50)
verboseNoInclude the raw metric counts for every file (default false)
directoryYesAbsolute path to the directory to scan
includeTestsNoRank test files too — *.spec.*, *.test.*, and anything under __tests__/test/tests/spec/__mocks__ (default false). They rank high for a structural reason rather than a real one: mocked awaits read as async complexity. Turn this on to audit a suite's own complexity.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.8.2

TDQS

A4.4/5.0
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses that it is deterministic, fast, and makes no model call, which is valuable for setting expectations. It also explains the 'includeTests' behavior and how test files are ranked for structural reasons. This goes beyond basic operation.

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 concise and front-loaded with the core purpose and metric. Each sentence adds value: purpose, exclusion of tests, efficiency, and usage guidance. The parameter detail is left to the schema, and the description doesn't repeat schema text.

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 tool with 4 params and no output schema, the description covers the key aspects: what it does, when to use, default behavior, and param semantics. It doesn't describe the return format explicitly, but that's not strictly necessary given no output schema and the simplicity of the tool. Minor gap: it could mention what happens if directory doesn't exist or is empty.

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 parameters are documented. The description adds value by explaining the impact of 'includeTests' in detail ('mocked awaits read as async complexity') and hinting at 'verbose' and 'limit'. It also adds context on default behavior (test files left out by default), which is not in 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 clearly states it walks a directory and ranks JavaScript/TypeScript files by risk density, distinguishing it from simple file listing. It also differentiates from sibling tools by focusing on ranking files by risk, not mapping dependencies or analyzing a single file. The title is consistent and the description elaborates on the specific metric.

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?

It explicitly directs when to use it: 'Call this at the start of a code review to decide which files are worth your attention.' It also implies when not to use it by mentioning 'instead of reading the tree in arbitrary order.' However, it doesn't explicitly compare against sibling tools like analyze_file or map_dependencies, though the context is clear enough.

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