fix(mcp): omit unset query params from REST requests

This commit is contained in:
CREDO23 2026-07-06 03:17:25 +02:00
parent cb22cc4bfc
commit abbb43632f

View file

@ -49,6 +49,10 @@ class SurfSenseClient:
files: Any | None = None,
) -> Any:
"""Send a request and return the parsed body, or raise ``ToolError``."""
# Omit unset query params: sending them empty makes the API parse ""
# as a value (e.g. int("") on folder_id) and fail.
if params is not None:
params = {key: value for key, value in params.items() if value is not None}
try:
response = await self._http.request(
method, path, params=params, json=json, data=data, files=files