# `MCP012` List requirements sorted by test coverage {bdg-ref-info}`mcp | tools ` {bdg-ref-info}`mcp | query ` {bdg-ref-info}`mcp | traceability ` > I would like to see which requirements are the least covered by tests, so I can > prioritize writing test plans for them. I want the requirements with no tests at all > to appear first, then those with few tests, then those that are only manually tested > before the fully automated ones. > The user shall be able to retrieve a ranked list of requirements ordered by ascending test coverage. The MCP server shall expose a tool named `least_tested_requirements` that returns all requirements sorted so the least tested appear first. The sort order shall be: 1. Ascending number of test plans (requirements with no tests come first) 2. Ascending number of automated test plans (fully manual requirements come before partially or fully automated ones) 3. Alphabetically by ID as a tiebreaker Each entry in the returned list shall contain: - `id`: The unique identifier - `short`: The short description (if present) - `category`: The requirement category - `test_plans`: Total number of tests that reference this requirement - `automated_test_plans`: Number of those tests that have at least one automated code test reference (a tagged code reference where the symbol is a test function) An optional `category` parameter allows filtering to a single category. An optional `tag` parameter allows filtering to requirements carrying a specific tag. Both filters may be combined. An optional `count` parameter limits the number of results returned (e.g. 5 returns only the 5 least tested requirements). Negative or out-of-range values shall be ignored. If the specified category or tag does not exist, the tool shall return an error. :::{dropdown} Properties :icon: note :color: primary __author__: Claude __since__: `0.4.0` ::: :::{dropdown} Tested by :open: :icon: check-circle-fill :color: success - [`TMCP045` least_tested_requirements returns all requirements sorted by coverage](/tests/TMCP045) - [`TMCP046` least_tested_requirements filtered by category](/tests/TMCP046) - [`TMCP047` least_tested_requirements filtered by tag](/tests/TMCP047) - [`TMCP048` least_tested_requirements limited by count](/tests/TMCP048) - [`TMCP049` least_tested_requirements errors on unknown category](/tests/TMCP049) - [`TMCP050` least_tested_requirements errors on unknown tag](/tests/TMCP050) - [`TMCP051` least_tested_requirements ignores negative count](/tests/TMCP051) - [`TMCP052` least_tested_requirements ignores count larger than result set](/tests/TMCP052) ::: :::{dropdown} References :icon: link :color: secondary __Relates to:__ [`MCP010` Get test plan coverage for requirements](/requirements/MCP010) ::: :::{dropdown} Source :icon: file-code :color: info __Source file__: [`specs/mcp/tracability.yaml`](https://github.com/agagniere/speky/blob/master/specs/mcp/tracability.yaml) __Loaded from__: [`speky_mcp`](https://github.com/agagniere/speky/blob/master/specs/mcp/mcp.toml) __Implemented in:__ {fab}`python` [`handle_least_tested_requirements`](https://github.com/agagniere/speky/blob/master/python/speky_mcp/tools.py#L174) :::