search
Find cryptocurrency and blockchain project data using keywords for project names, tokens, or related terms to access brief information about projects, venture capital firms, and people in the industry.
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:51-73 (handler)The handler function for the 'search' MCP tool, registered via @mcp.tool(). It queries the RootData API endpoint 'ser_inv' with the provided keywords and returns formatted JSON results or appropriate error messages.@mcp.tool() 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:28-49 (helper)Supporting helper function used by the 'search' tool (and others) to perform authenticated asynchronous HTTP POST requests to the RootData API.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)}