PulseAugur
EN
LIVE 14:31:01

MCP tool bug: Negative limit parameter returns nearly all repos

A bug in the `list_repos` function of the MCP tool was discovered where passing a negative value for the `limit` parameter resulted in almost all repositories being returned, contrary to the docstring's claim of a 1-100 limit. This occurred because Python's list slicing interprets negative indices as counting from the end, and the existing code only clamped the upper bound, not the lower one. The fix involves adding a `max(0, ...)` clamp to ensure that negative or zero limits correctly return an empty list, aligning the function's behavior with its documented contract. AI

IMPACT Fixes a potential issue where AI models could unintentionally retrieve excessive data by misinterpreting negative limit parameters.

RANK_REASON Bug fix in a specific tool's function.

Read on dev.to — MCP tag →

AI-generated summary · Google Gemini · from 1 sources. How we write summaries →

MCP tool bug: Negative limit parameter returns nearly all repos

COVERAGE [1]

  1. dev.to — MCP tag TIER_1 English(EN) · Enjoy Kumawat ·

    "My MCP Tool's Docstring Promised 'limit: 1-100.' Passing -1 Returned Almost Everything, Not Nothing."

    <p>Every audit of <code>server.py</code> I've done before this one went looking for a specific bug shape first — a missing except block, a docstring's claimed API parameter GitHub silently ignores, a <code>sort=</code> value that isn't actually supported. Those are all things you…