web_search
Search the web to find answers, facts, or recent updates by providing a search query.
Instructions
使用 MiniMax 进行网络搜索
Args: query: 搜索查询词,例如 "OpenAI GPT-5 发布日期"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- src/minimax_mcp/server.py:65-73 (handler)MCP tool registration and entry point: the @mcp.tool() decorator registers 'web_search' as an MCP tool. It delegates to the actual implementation in tools/web_search.py.
@mcp.tool() def web_search(query: str) -> dict: """使用 MiniMax 进行网络搜索 Args: query: 搜索查询词,例如 "OpenAI GPT-5 发布日期" """ from minimax_mcp.tools.web_search import web_search as _run return _run(get_client(), query) - Tool logic implementation: validates input, calls the HTTP client, and formats the search results from MiniMax API into structured output with title, url, snippet, date, and related searches.
def web_search(client: MiniMaxClient, query: str) -> dict: """使用 MiniMax 进行网络搜索 Args: client: MiniMax API 客户端 query: 搜索查询词 Returns: { success: bool, query: str, results: [{title, url, snippet, date?}], related_searches: [...], } """ if not query or not query.strip(): return {"success": False, "error": "query 不能为空"} result = client.web_search(query=query.strip()) if not result.get("success"): return { "success": False, "query": query, "error": result.get("error", "Search failed"), "detail": result.get("detail", ""), } data = result.get("data", result) # 实际响应: {"organic": [{title, link, snippet, ...}]} search_results = data.get("organic", []) if isinstance(search_results, list): formatted = [] for item in search_results: if isinstance(item, str): formatted.append({"title": item, "url": "", "snippet": ""}) elif isinstance(item, dict): formatted.append({ "title": item.get("title", ""), "url": item.get("link", item.get("url", "")), "snippet": item.get("snippet", item.get("summary", "")), "date": item.get("date", item.get("published", "")), }) else: formatted = [] return { "success": True, "query": query, "results": formatted, "result_count": len(formatted), "related_searches": data.get("related_searches", []), "raw": result, } - src/minimax_mcp/client.py:45-51 (helper)HTTP client method that sends a POST request to MiniMax's /v1/coding_plan/search endpoint with the search query.
def web_search(self, query: str) -> dict: """网络搜索 POST {host}/v1/coding_plan/search Body: {"query": "..."} """ return self._request("POST", "/v1/coding_plan/search", body={"q": query}) - src/minimax_mcp/server.py:172-173 (registration)Resource listing confirms web_search is registered as a tool in the minimax-mcp service.
"tools": ["query_quota", "web_search", "understand_image", "generate_image", "clear_vision_cache"], "config": cfg, - Docstring describing the API contract: POST to /v1/coding_plan/search with query parameter.
""" MCP Tool: web_search — MiniMax 网络搜索 API: POST {host}/v1/coding_plan/search Body: {"query": "..."} """