search
Query cryptocurrency and blockchain project data, including project details, institutions, and related terms, using keywords for precise information retrieval.
Instructions
Search for Project/VC/People brief information according to keywords.
Args:
query: Search keywords, which can be project/institution names, tokens, or other related terms.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- server.py:52-73 (handler)The async handler function for the MCP 'search' tool. It takes a query string, calls the RootData API 'ser_inv' endpoint via the make_request helper, and returns formatted JSON results or appropriate error/no-results messages.async def search(query: str) -> str: """Search for Project/VC/People brief information according to keywords. Args: query: Search keywords, which can be project/institution names, tokens, or other related terms. """ # Prepare request data data = {"query": query} # Fetch data from the API response = await make_request("ser_inv", data) # Check if there was an error if "Error" in response: return f"Error: {response['Error']}" # Check if data is found if response.get("result") != 200 or not response.get("data"): return "No results found for your search query." # Return the formatted results return json.dumps(response["data"], indent=2)
- server.py:51-51 (registration)The @mcp.tool() decorator that registers the 'search' function as an MCP tool.@mcp.tool()
- server.py:53-57 (schema)The docstring providing the tool description and argument schema (query: Search keywords...), which FastMCP uses to generate the JSON schema."""Search for Project/VC/People brief information according to keywords. Args: query: Search keywords, which can be project/institution names, tokens, or other related terms. """
- server.py:28-49 (helper)The make_request helper function that performs the actual async HTTP request to the RootData API, handling authentication and errors, used by the search handler.async def make_request(endpoint: str, data: dict) -> dict[str, any] | None: """Make a request to the RootData API with proper error handling.""" headers = { "Content-Type": "application/json", "language": "en", } if api_key := os.environ.get("ROOTDATA_API_KEY"): headers["apikey"] = api_key else: return {"Error": "ROOTDATA_API_KEY environment variable is not set"} url = f"{ROOTDATA_API_BASE}/{endpoint}" async with httpx.AsyncClient() as client: try: response = await client.post(url, headers=headers, json=data, timeout=30.0) response.raise_for_status() return response.json() except Exception as e: return {"Error": str(e)}