aminghadersohi opened a new pull request, #40906:
URL: https://github.com/apache/superset/pull/40906

   ## Summary
   
   - **Root cause**: `BM25SearchTransform._make_search_tool()` declares `query: 
str` (required). When an LLM calls `search_tools({})` for tool discovery, 
`TypeAdapter.validate_python({})` raises `ValidationError` because the required 
field is missing. `StructuredContentStripperMiddleware` catches this and 
returns error text instead of the tool catalog — so the LLM receives null/empty 
content.
   - **Fix**: Override `_make_search_tool()` in both 
`_FixedBM25SearchTransform` and `_FixedRegexSearchTransform` to accept `query: 
str | None = None`. When omitted, returns all visible tools directly; when 
provided, runs the configured search strategy as before.
   - **Tests**: Three new unit tests verify the schema marks `query` as 
optional, calling with no args returns all tools (BM25 + regex strategies).
   
   ## Test plan
   
   - [ ] `pytest 
tests/unit_tests/mcp_service/test_tool_search_transform.py::test_search_tool_query_is_optional_in_schema`
   - [ ] `pytest 
tests/unit_tests/mcp_service/test_tool_search_transform.py::test_search_tool_with_no_query_returns_all_visible_tools`
   - [ ] `pytest 
tests/unit_tests/mcp_service/test_tool_search_transform.py::test_search_tool_regex_with_no_query_returns_all_visible_tools`


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