Problem
Block has about 200M data tables, 40+ data teams and four dashboarding tools; the rest of the knowledge lives in Google docs, Slack and people's heads. Finding the right table and expert is slow, and data scientists become the bottleneck for ad hoc requests. Early AI experiments made it worse: incompatible team tools and unverified insights from SQL with made-up tables and columns.
Example from the article: in early 2025 the tax reporting PM at Square wanted a more cohesive experience with Cash App Tax Filing. It took two weeks just to find the right data team, table and query.
Solution in brief
Block built Query Expert, an MCP server that gives any agent three vector indices: tables, queries and business knowledge. The tables are documented by an LLM inside SQL, and the queries are mined from query history. Retrieval filters by domain, reranks by trust and recency, and shows the agent only the best chunks in full.
Questions this case answers
- How to make an LLM agent write correct queries in a company with thousands of undocumented tables by retrieving tables, past queries and domain knowledge from linked indices and reranking them by trust
- How to generate documentation for thousands of undocumented tables automatically from usage history and keep it fresh
- How to make an LLM agent write correct SQL in a company with thousands of undocumented tables
- How to find the right table, the right expert and the right join pattern for a data question
Tools and methods
- Databricks Vector Search — hybrid retrieval with metadata filters over three linked indices
- Databricks
AI_QUERY()— LLM completions inside SQL to document tables and columns at scale - Query-history mining — filter, weight and sample 400M monthly queries down to 1M
- Custom reranking — adjusts the semantic score by source, recency, join validity and verification status
- Progressive disclosure and score boundary — limit what the agent sees
- GitHub pull requests — human review of bot-generated context
Google or a one-time email code. No password.