MCPcopy Index your code
hub / github.com/grapeot/devin.cursorrules / search

Function search

tools/search_engine.py:49–65  ·  view source on GitHub ↗

Main search function that handles search with retry mechanism. Args: query (str): Search query max_results (int): Maximum number of results to return max_retries (int): Maximum number of retry attempts

(query, max_results=10, max_retries=3)

Source from the content-addressed store, hash-verified

47 print(f"Snippet: {r.get('body', 'N/A')}")
48
49def search(query, max_results=10, max_retries=3):
50 """
51 Main search function that handles search with retry mechanism.
52
53 Args:
54 query (str): Search query
55 max_results (int): Maximum number of results to return
56 max_retries (int): Maximum number of retry attempts
57 """
58 try:
59 results = search_with_retry(query, max_results, max_retries)
60 if results:
61 format_results(results)
62
63 except Exception as e:
64 print(f"ERROR: Search failed: {str(e)}", file=sys.stderr)
65 sys.exit(1)
66
67def main():
68 parser = argparse.ArgumentParser(description="Search using DuckDuckGo API")

Callers 4

test_no_resultsMethod · 0.90
test_search_errorMethod · 0.90
mainFunction · 0.85

Calls 2

search_with_retryFunction · 0.85
format_resultsFunction · 0.85

Tested by 3

test_no_resultsMethod · 0.72
test_search_errorMethod · 0.72