search_public_queries
Find existing SQL queries by keyword to discover relevant table names for data analysis.
Instructions
Search public queries by keyword. Use this to discover table names from existing SQL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- src/main.py:91-110 (handler)The handler function decorated with @mcp.tool(), implementing the search_public_queries tool. It calls dune_service.search_queries(query), handles errors, and formats the top 10 results as a string.@mcp.tool() def search_public_queries(query: str) -> str: """ Search public queries by keyword. Use this to discover table names from existing SQL. """ results = dune_service.search_queries(query) # Handle WAF/Error if isinstance(results, dict) and "error" in results: return f"Error: {results['error']}" if not results: return f"No public queries found matching '{query}'." # Format as string summary summary = [] for q in results[:10]: # Limit to 10 summary.append(f"ID: {q.get('id')} | Name: {q.get('name')} | Owner: {q.get('owner')}") return "\n".join(summary)