gabotorresruiz commented on code in PR #40906:
URL: https://github.com/apache/superset/pull/40906#discussion_r3384466656
##########
superset/mcp_service/server.py:
##########
@@ -619,14 +619,39 @@ async def call_tool(
)
-def _create_search_transform(
+def _create_search_transform( # noqa: C901
*,
strategy: str,
kwargs: dict[str, Any],
make_normalizing_call_tool: Callable[[Any], Any],
) -> Any:
"""Create the configured search transform with tool-permission
filtering."""
from fastmcp.server.context import Context
+ from fastmcp.tools.base import Tool
+
+ def _make_optional_query_search_tool(transform: Any) -> Any:
+ """Create search tool with optional query — returns all tools when
omitted."""
+
+ async def search_tools(
+ query: Annotated[
+ str | None,
+ "Natural language query. Omit to list all available tools.",
+ ] = None,
Review Comment:
One thing on the schema: `query: str | None` renders as `{"anyOf":
[{"type":"string"},{"type":"null"}]}` with no top-level type, same shape as
`call_tool`'s arguments, which is exactly what `_fix_call_tool_arguments`
flattens (its docstring notes mcp-remote/Claude Desktop strip `anyOf` and leave
the field typeless). So we'd be reintroducing an unflattened `anyOf` for those
bridges.
Probably milder than the `call_tool` case (query is optional and usually
omitted, so it may not actually break) but it's the same shape that bit us
before, and flattening to a plain `{"type": "string"}` is cheap. Might also be
worth having `test_search_tool_query_is_optional_in_schema` assert query has a
concrete type, since that's what the bridges trip on.
--
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]