Fix the bug where the mcp service tools/list does not return knowledge base IDs information. (#13123)

Fix the issue where the server-side parameter validation fails when the
id parameter is None in the asynchronous list_datasets method.

### What problem does this PR solve?

Fix the issue where the server-side parameter validation fails when the
id parameter is None in the asynchronous list_datasets method.

### Type of change

- [√ ] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
疯癫
2026-02-12 15:40:15 +08:00
committed by GitHub
parent 6e7bcf58bc
commit e72291bc9a

View File

@ -138,7 +138,13 @@ class RAGFlowConnector:
id: str | None = None,
name: str | None = None,
):
res = await self._get("/datasets", {"page": page, "page_size": page_size, "orderby": orderby, "desc": desc, "id": id, "name": name}, api_key=api_key)
params = {"page": page, "page_size": page_size, "orderby": orderby, "desc": desc}
if id:
params['id'] = id
if name :
params['name'] = name
res = await self._get("/datasets", params, api_key=api_key)
if not res or res.status_code != 200:
raise Exception([types.TextContent(type="text", text="Cannot process this operation.")])