MCPcopy Create free account
hub / github.com/ScrapeGraphAI/scrapecraft / search_urls

Function search_urls

backend/app/api/workflow_v2.py:52–79  ·  view source on GitHub ↗

Search for URLs using the enhanced workflow manager. This endpoint uses the tool-based agent if enabled for better search capabilities.

(
    search_query: str,
    pipeline_id: str,
    max_results: int = Query(10, ge=1, le=50),
    connection_manager: ConnectionManager = Depends(lambda: ConnectionManager()),
    current_user: User = Depends(get_current_user)
)

Source from the content-addressed store, hash-verified

50
51@router.post("/search")
52async def search_urls(
53 search_query: str,
54 pipeline_id: str,
55 max_results: int = Query(10, ge=1, le=50),
56 connection_manager: ConnectionManager = Depends(lambda: ConnectionManager()),
57 current_user: User = Depends(get_current_user)
58) -> Dict[str, Any]:
59 """
60 Search for URLs using the enhanced workflow manager.
61
62 This endpoint uses the tool-based agent if enabled for better search capabilities.
63 """
64 use_tools = os.getenv("USE_TOOLS_AGENT", "false").lower() == "true"
65 manager = get_enhanced_workflow_manager(connection_manager, use_tools)
66
67 try:
68 urls = await manager.search_urls(pipeline_id, search_query)
69
70 return {
71 "success": True,
72 "query": search_query,
73 "urls": urls,
74 "count": len(urls),
75 "agent_mode": "tools-based" if use_tools else "state-based"
76 }
77
78 except Exception as e:
79 raise HTTPException(status_code=500, detail=str(e))
80
81
82@router.post("/scrape")

Callers

nothing calls this directly

Calls 3

ConnectionManagerClass · 0.90
search_urlsMethod · 0.45

Tested by

no test coverage detected