MCP get_search_results 增加 include_labels 按需返回种子标签 (#6335)

让 Agent 在筛选命中标签时能按需查看 labels,默认不返回以免拉长上下文。

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 6a02e7de21)
This commit is contained in:
LinFei83
2026-08-16 17:38:19 +08:00
committed by jxxghp
parent 3e417c1ac5
commit e5f0c53069
5 changed files with 26 additions and 4 deletions
@@ -54,6 +54,17 @@ def test_simplify_search_result_only_includes_description_when_requested():
assert detailed_result["torrent_info"]["description"] == "简繁特效字幕"
def test_simplify_search_result_only_includes_labels_when_requested():
"""精简结果应按参数控制标签输出,避免默认增加上下文长度。"""
context = _build_context("Movie.2026.1080p", labels=["官译", "特效"])
default_result = simplify_search_result(context, 1)
detailed_result = simplify_search_result(context, 1, include_labels=True)
assert "labels" not in default_result["torrent_info"]
assert detailed_result["torrent_info"]["labels"] == ["官译", "特效"]
def test_content_pattern_matches_title_description_and_labels():
"""内容正则应联合匹配标题、简介和标签,并可返回命中的简介。"""
items = [