PulseAugur
实时 03:52:15
English(EN) "My MCP Tool's Docstring Promised 'limit: 1-100.' Passing -1 Returned Almost Everything, Not Nothing."

MCP 工具 bug:负 limit 参数返回几乎所有仓库

MCP 工具的 `list_repos` 函数中发现了一个 bug,当 `limit` 参数传入负值时,会返回几乎所有仓库,这与文档字符串声称的 1-100 限制不符。这是因为 Python 的列表切片将负索引解释为从末尾开始计数,而现有代码仅限制了上限,并未限制下限。修复方法是添加一个 `max(0, ...)` 限制,以确保负值或零限制能正确返回空列表,使函数的行为与其文档契约保持一致。 AI

影响 修复了 AI 模型可能因误解负 limit 参数而无意中检索过多数据的潜在问题。

排序理由 特定工具函数中的 bug 修复。

在 dev.to — MCP tag 阅读 →

AI 生成摘要 · Google Gemini · 来自 1 个来源。 我们如何撰写摘要 →

MCP 工具 bug:负 limit 参数返回几乎所有仓库

本文如何被排名

Signal score
0 / 100
Composite score across the factors below. Higher = stronger signal that this story matters right now.
Newsworthiness bucket
Tool
特定工具函数中的 bug 修复。
Source corroboration
Single-source cluster
Only one publisher covered this so far. Single-source stories can still rank when the publisher is high-authority, but they lack cross-source corroboration.
Topics
product, other
Editorial topic classification. Feeds into how the story surfaces on /topic/<slug> hub pages and into the per-entity coverage mix.
AI-industry relevance
High
Clearly on-topic for AI-industry coverage.
Story freshness
23 days old
Aged out of breaking-news scoring windows; ranking reflects the durable signal from the full source set.

完整方法见我们的编辑标准

报道来源 [1]

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

    我的 MCP 工具的 docstring 曾承诺‘limit: 1-100’。传入 -1 返回了几乎所有内容,而不是零。

    <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…