+
Skip to content

Conversation

IsmailMabrouki
Copy link

Description

Fixes #362 - "Query is missing" error when using TavilySearchRM with MCP servers

This PR adds comprehensive input validation to TavilySearchRM.forward() to handle empty, None, or invalid queries gracefully.

Problem

Users reported getting "Query is missing" errors when integrating STORM with MCP (Model Context Protocol) servers. The error occurred when empty or None queries were passed to the Tavily search API.

Solution

  • Input Validation: Added checks for empty, None, or whitespace-only queries
  • List Filtering: For list inputs, filter out invalid queries and keep only valid ones
  • Graceful Handling: Return empty results instead of crashing
  • Error Handling: Added try-catch around the Tavily API call
  • Debug Support: Added informative warning messages

Changes Made

  • Modified knowledge_storm/rm.py in TavilySearchRM.forward() method
  • Added comprehensive input validation before API calls
  • Added error handling around tavily_client.search(query)

Testing

The fix correctly handles:

  • Empty strings ("")
  • Whitespace-only strings (" ")
  • None values
  • Empty lists ([])
  • Lists with mixed valid/invalid queries
  • Valid queries (unchanged behavior)

Backward Compatibility

✅ This change is fully backward compatible - all existing valid use cases continue to work exactly as before.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

…ing' error

- Add input validation for empty, None, and whitespace-only queries
- Filter out invalid queries from lists while keeping valid ones
- Add error handling around Tavily API calls
- Return empty results gracefully instead of crashing
- Add informative warning messages for debugging

Fixes stanford-oval#362
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Query is missing
1 participant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载