rebenitez1802 commented on code in PR #43828:
URL: https://github.com/apache/superset/pull/43828#discussion_r3932909400
##########
superset/core/mcp/core_mcp_injection.py:
##########
@@ -38,6 +41,83 @@
logger = logging.getLogger(__name__)
+def _strip_schema_titles(value: Any) -> Any:
+ """Remove generated JSON Schema titles while preserving useful metadata."""
+ if isinstance(value, list):
+ return [_strip_schema_titles(item) for item in value]
+ if not isinstance(value, dict):
+ return value
+ return {
+ key: _strip_schema_titles(item) for key, item in value.items() if key
!= "title"
+ }
Review Comment:
**🟡 Medium — `_strip_schema_titles` drops response fields literally named
`title`**
This strips *every* dict key named `title` at any depth, but a model field
named `title` appears as the key `properties.title` — so its whole subschema is
deleted, not just a generated annotation. Live example:
`open_sql_lab_with_context`'s `SqlLabResponse.title`
(`superset/mcp_service/sql_lab/schemas.py:318`) disappears from the advertised
`outputSchema`. Only strip `title` when it's the generated string annotation,
never when it's a property/def whose value is a subschema dict:
```suggestion
return {
key: _strip_schema_titles(item)
for key, item in value.items()
if not (key == "title" and isinstance(item, str))
}
```
--
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]