MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / build_tool

Function build_tool

bmtools/tools/google_serper/api.py:102–124  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

100
101
102def build_tool(config) -> Tool:
103
104 tool = Tool(
105 "google_serper",
106 "Look up for information from Serper.dev Google Search API",
107 name_for_model="google_serper",
108 description_for_model=(
109 "A low-cost Google Search API."
110 "Useful for when you need to answer questions about current events."
111 "Input should be a search query. Output is a JSON object of the query results"
112 ),
113 logo_url="https://your-app-url.com/.well-known/logo.png",
114 contact_email="hello@contact.com",
115 legal_info_url="hello@legal.com"
116 )
117 api_wrapper = GoogleSerperAPIWrapper(config["subscription_key"])
118
119 @tool.get("/search_general")
120 def search_general(query : str):
121 """Run query through GoogleSearch and parse result."""
122 return str(api_wrapper.run(query))
123
124 return tool

Callers

nothing calls this directly

Calls 2

ToolClass · 0.50

Tested by

no test coverage detected