Description
The Google Custom Search API limits results to 10 per request, but _search_google silently caps results at 10 without informing the user or implementing pagination for higher counts.
Current behavior
def _search_google(...):
response = httpx.get(
"https://www.googleapis.com/customsearch/v1",
params={
"key": api_key,
"cx": cse_id,
"q": query,
"num": min(num_results, 10), # Silent cap at 10
# ...
}
)
If a user requests 15 results, they silently get only 10 with no indication that their request was truncated.
Steps to reproduce
result = web_search(
query="test",
num_results=15,
provider="google"
)
print(result['total']) # Shows 10, not 15
print(result.get('truncated')) # No indication of truncation
Expected behavior
Either:
- Implement pagination to fetch 10+ results using the
start parameter
- Return an error when
num_results > 10 for Google
- Add a warning in the response that results were truncated
Environment
- File:
tools/src/aden_tools/tools/web_search_tool/web_search_tool.py:35
Suggested fix
Option 1: Add truncation warning
result = {
"query": query,
"results": results,
"total": len(results),
"provider": "google",
}
if num_results > 10:
result["warning"] = f"Google API limited results to 10 (requested {num_results})"
return result
Option 2: Implement pagination (for 10+ results)
# Make multiple API calls with 'start' parameter
# First call: start=1 (results 1-10)
# Second call: start=11 (results 11-20)
# etc.
Happy to submit a PR for this!
Description
The Google Custom Search API limits results to 10 per request, but
_search_googlesilently caps results at 10 without informing the user or implementing pagination for higher counts.Current behavior
If a user requests 15 results, they silently get only 10 with no indication that their request was truncated.
Steps to reproduce
Expected behavior
Either:
startparameternum_results > 10for GoogleEnvironment
tools/src/aden_tools/tools/web_search_tool/web_search_tool.py:35Suggested fix
Option 1: Add truncation warning
Option 2: Implement pagination (for 10+ results)
Happy to submit a PR for this!