MCPcopy Create free account
hub / github.com/Alibaba-NLP/DeepResearch / call

Method call

WebAgent/WebResummer/src/tool_search.py:89–103  ·  view source on GitHub ↗
(self, params: Union[str, dict], **kwargs)

Source from the content-addressed store, hash-verified

87
88
89 def call(self, params: Union[str, dict], **kwargs) -> str:
90 assert GOOGLE_SEARCH_KEY is not None, "Please set the GOOGLE_SEARCH_KEY environment variable."
91 try:
92 query = params["query"]
93 except:
94 return "[Search] Invalid request format: Input must be a JSON object containing 'query' field"
95
96 if isinstance(query, str):
97 response = self.google_search(query)
98 else:
99 assert isinstance(query, List)
100 with ThreadPoolExecutor(max_workers=3) as executor:
101 response = list(executor.map(self.google_search, query))
102 response = "\n=======\n".join(response)
103 return response
104
105
106###### Test Code ######

Callers 1

tool_search.pyFile · 0.45

Calls 1

google_searchMethod · 0.95

Tested by

no test coverage detected