mikebridge commented on code in PR #44266:
URL: https://github.com/apache/superset/pull/44266#discussion_r4043734467


##########
superset/mcp_service/semantic_layer/schemas.py:
##########
@@ -105,17 +111,37 @@ class ListMetricsRequest(BaseModel):
         description="Filter to metrics from a specific semantic view.",
     )
     include_compatible_dimensions: bool = Field(
-        default=True,
+        default=False,
         description=(
-            "When True, each metric includes its list of compatible 
dimensions. "
-            "Set to False to reduce response size when dimensions aren't 
needed."
+            "Embed compatible dimensions only when explicitly requested. "
+            "Use get_compatible_dimensions for the full per-metric list. "
+            "When True, set page_size to at most 8."
         ),
     )
     page: int = Field(default=1, ge=1, description="1-based page number.")
     page_size: int = Field(
-        default=50, ge=1, le=500, description="Number of metrics per page."
+        default=25, ge=1, le=500, description="Number of metrics per page."
     )
 
+    @model_validator(mode="after")
+    def validate_embedded_dimensions_page_size(self) -> "ListMetricsRequest":
+        """Reject embedded pages that risk exceeding the MCP response guard."""
+        if (
+            self.include_compatible_dimensions
+            and self.page_size > EMBEDDED_DIMENSIONS_MAX_PAGE_SIZE

Review Comment:
   Good catch — addressed in 7c70999fab59ea8933c342aa5d379295f514ae6c. Explicit 
dataset_id requests retain the existing 500-metric ceiling in embedded mode; 
semantic-view and unscoped requests retain cap 8 because they can include 
external dimensions. Added MCP call_tool cases for built-in pages 9/25/500 (all 
fail against the old validator), plus external/unscoped page-9 rejection 
checks. UPDATING and schema guidance clarify the scope. The two affected suites 
pass 134 tests using this checkout’s tracked core source, and applicable 
branch-file hooks pass. The runtime response-size guard still applies; this 
does not guarantee arbitrary built-in payloads fit or change the configured 
token limit.



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

Reply via email to