aminghadersohi commented on code in PR #38562:
URL: https://github.com/apache/superset/pull/38562#discussion_r2930520624


##########
superset/mcp_service/server.py:
##########
@@ -151,6 +155,106 @@ def create_event_store(config: dict[str, Any] | None = 
None) -> Any | None:
         return None
 
 
+def _strip_titles(obj: Any) -> Any:
+    """Recursively strip 'title' keys from JSON Schema objects.
+
+    Pydantic auto-generates 'title' for every field and model (e.g.
+    "title": "Chart Type" for a field named chart_type). These are
+    redundant with property names and inflate schema size by ~12%.
+    """
+    if isinstance(obj, dict):
+        return {k: _strip_titles(v) for k, v in obj.items() if k != "title"}
+    if isinstance(obj, list):
+        return [_strip_titles(item) for item in obj]

Review Comment:
   Good catch. Already addressed: `_strip_titles` uses an `in_properties_map` 
flag to preserve real property names called `title` inside `properties` maps, 
while only stripping auto-generated schema metadata `title` keys at 
non-property levels.



##########
superset/mcp_service/server.py:
##########
@@ -252,6 +364,13 @@ def run_server(
             middleware=middleware_list or None,
         )
 
+        # Apply tool search transform if configured
+        tool_search_config = flask_app.config.get(
+            "MCP_TOOL_SEARCH_CONFIG", MCP_TOOL_SEARCH_CONFIG
+        )
+        if tool_search_config.get("enabled", False):
+            _apply_tool_search_transform(mcp_instance, tool_search_config)

Review Comment:
   Good catch — fixed. After the transform is applied, we now add the 
configured `search_tool_name` to the size guard's `excluded_tools` set so 
customized names are also excluded: ca640675..HEAD.



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