aminghadersohi commented on code in PR #41698:
URL: https://github.com/apache/superset/pull/41698#discussion_r3546782330
##########
superset/mcp_service/middleware.py:
##########
@@ -1182,13 +1184,15 @@ def __init__(
token_limit: int = DEFAULT_TOKEN_LIMIT,
warn_threshold_pct: int = DEFAULT_WARN_THRESHOLD_PCT,
excluded_tools: list[str] | str | None = None,
+ max_list_items: int = DEFAULT_MAX_LIST_ITEMS,
) -> None:
self.token_limit = token_limit
self.warn_threshold_pct = warn_threshold_pct
self.warn_threshold = int(token_limit * warn_threshold_pct / 100)
if isinstance(excluded_tools, str):
excluded_tools = [excluded_tools]
self.excluded_tools = set(excluded_tools or [])
+ self.max_list_items = max_list_items
Review Comment:
Fixed in 76b6542 (via commit d0179b246). ResponseSizeGuardMiddleware now
clamps its constructor input with self.max_list_items = max(1, max_list_items),
so a misconfigured MCP_RESPONSE_SIZE_CONFIG (0 or negative) can no longer
produce nonsensical list slicing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]