The questions we didn’t build a screen for

Ask Alberta’s grant payments table how much Alberta Health Services received in 2024–2025 and it gives you 625 rows, 10 to a page, and no total. The answer is $16.56 billion. To get it, you can page through 63 screens and keep a running sum, or find the raw files.

The table is doing what it was built to do. Most of the data systems we build for government are a database with screens in front of it. Each screen answers a question the service needs answered, the same way, for everyone who uses it.

Then someone asks a question nobody planned for. How much did this recipient get from both governments last year? Which programs grew the most? What share of a ministry’s spending went to recipients it didn’t name? Questions like these change daily, and no roadmap can ship a screen for each, nor should it try.

So people take the usual route: narrow the list as far as the filters allow, export to CSV, open Excel, and build a pivot table. Some teams load the export into a business intelligence (BI) tool instead. Either way, each new question means more setup, and the answer lives in a file or report the system never sees.


We thought an AI assistant could give people a more flexible way to explore an existing dataset by asking questions in plain language, the way they would ask a colleague. It would answer the analytical questions an application’s screens weren’t designed for, without a new report or screen for each.

Two conditions had to be met. The answers had to be accurate, and the data had to stay protected, so the assistant could reach only what we chose to expose.

We expected connecting the assistant to be the easy part. We hadn’t yet found that the obvious way to add up federal agreements was off by about $300 billion.


To give the experiment a baseline, we wrote 12 analysis questions of the kind a program analyst, a journalist, or a sector researcher might ask: questions that total, group, or compare funding rather than look up a single record. We then ran each question against two systems. The governments’ public search pages could answer one of them. An AI assistant with read-only access to the same data answered all 12, each in one or two steps.

We ran the questions on a testbed we called GrantLedger. It loads two public disclosures into one model: the Government of Canada’s grants and contributions, 1.3 million rows, and the Government of Alberta’s grant payments, 2 million. Each government publishes a search page over its own data. Neither page can total, group, or compare, and neither links to the other’s data.

GrantLedger is a web app with the features these systems usually have: 17 pages of drill-down lists and dashboards, filters, a column picker, and a CSV export. That makes it a fair comparison. For an analysis question, the most it offers is a faster export to Excel.

To let an assistant ask questions of the same database, we used the Model Context Protocol (MCP), a standard for giving AI assistants tools. A server publishes named operations with typed arguments and a description of each, and the assistant decides which to call and writes its answer from the results. Our server sits beside the web app as a second front door to the same database.

Making the data accessible

Take one of the 12: “Which organizations received funding from both governments in FY2024?” (FY2024 is the fiscal year that began in April 2024.) Through the portals, that’s two exports and matching names by hand in Excel. Through the server, it’s one call to shared_recipients, which returns 1,410 organizations with both amounts side by side.

RecipientAlberta paid in FY2024Canada committed in FY2024 agreements
Alberta Health Services$16.56B in 625 payments$1.17M in 13 agreements
City of Calgary$464.8M$253.7M
University of Calgary$545.1M$30.1M
Dow Chemical Canada$10.8M$400.0M in one agreement
Enoch Cree Nation$213,302$142.0M in one agreement

No portal, or screen in our own web app, produces that table. The server labels the columns as cash paid and value committed, because you can’t add the figures together.

The server has 17 tools. A schema tool describes the data and its conventions, list and get tools return records, four curated aggregate tools answer the questions we expected most, and one constrained query tool handles everything else. We described the data once and let the assistant compose the rest.

We had three readers in mind for the questions: a program analyst, a journalist, and a sector researcher. We tried each question against the two governments’ portals first, then we wrote the MCP calls ourselves and ran them through a real client session.

Of the 11 the portals couldn’t answer, five got partway before needing an export, and six couldn’t be started. One of the server’s answers was that 36 First Nations received money from both governments in FY2023 and FY2024, led by Sunchild First Nation. The rest are in the repository with their recorded answers.

We chose 12 questions ourselves and the bank measures what the server can retrieve. How reliably an assistant picks the right calls needs a separate test.

The same server works from Claude Desktop, Claude Code, claude.ai, and ChatGPT. We wrote no client-specific code for any of them, because each one reads the same tool descriptions.

Making the answers meaningful

Most wrong answers come from things the data doesn’t say about itself, and we found five the server has to spell out for the assistant.

What the data doesn’t sayWhat goes wrong
Both governments run an April-to-March fiscal yearA calendar-year total is three months out of step
Federal rows are agreements, a value committed over a term; Alberta rows are payments, cash on a dateAdding the two produces a number that means nothing, and an assistant will add them if asked
Alberta publishes a quarter of its dollars with no recipient, as yearly program totals with physician fees and income support among them“RECIPIENT NOT DISCLOSED” ranks as Alberta’s second-biggest recipient in FY2024
Ministries are renamed with cabinet shuffles, and recipients splitIn FY2026 to date, Alberta Health Services reads as down 89 percent while three new agencies appear beside it
Federal departments disclose each agreement once per amendmentSumming the rows counts the same money more than once

We found the last one the hard way. A question in our bank asked for the amendment history of the largest federal agreement in Alberta, and the server returned a single version. Several departments, it turned out, file each amendment under a new reference number, so nothing in the rows says they belong to one agreement. Add them up and you count the same money more than once.

One Indigenous Services Canada agreement appears as 463 rows that sum to $2.65 billion. The agreement is worth $1.33 billion. Across the federal dataset, the same effect inflates the total by about $300 billion. The fix was to group versions by department, agreement number, recipient, and start date, which collapses each set into one agreement.

The schema tool states each convention, and the defaults enforce them: award tools return only the latest amendment unless told otherwise, recipient rankings leave out placeholders, and aggregates report agreement value and payment value side by side. The server’s instructions also ask the assistant to cite each publisher and its licence.

Building the testbed also meant fixing broken files and mixed encodings. Six years of Alberta’s files had unquoted commas in ministry and program names, and our first import put program names in the amount column without raising an error.

We checked the question bank’s figures against the database and against the publishers’ own counts, and they held. One limit remains: the server matches names exactly, so an organization the two governments spell differently never appears as shared. The best it can do is list possible variants.

Keeping access controlled

The server enforces its own limits, so safety doesn’t depend on a prompt. It can only read. It checks every field, operator, sort, and aggregation against an allowlist of six models before it builds a query. No tool takes SQL. The user and OAuth tables aren’t reachable, and we have tests that confirm it. Ask for them anyway and the server replies, “Unknown or disallowed model ‘user’. Allowed: award, fiscal_year, ministry, organization, program, recipient.”

Remote clients sign in through OAuth 2.1, federated to Google. Every call writes one JSON audit line recording the tool, its arguments, the caller, and the row count. The web app’s API reuses the same allowlist and filter builder, so a filter means the same thing through either front door.

Both files name people, and the open-government licences don’t cover personal information. So the importer withholds any name that looks like a person’s under a single placeholder and keeps the dollars in the totals. That is 28 percent of federal rows and 36 percent of Alberta’s.

The connector we cared about most is Claude for Excel, because Excel is where these questions used to end up. Once GrantLedger is a custom connector in Claude’s settings, it appears in Excel under the + button.

We asked for every disclosed version of that Indigenous Services Canada agreement. Claude read the schema, found the agreement, pulled all 463 versions with superseded amendments included, landed them on a sheet, and charted them. Two cells beside the chart show every row summed, which is what you get from summing the portal’s export, and the row flagged as current. The same limits apply in Excel, and the server logs those calls too.


Existing data can answer questions its applications weren’t designed for. By exposing reusable query operations, we could answer all twelve analytical questions without developing a separate report for each. The approach still requires a well-defined data model, but it allows people to ask questions in natural language and explore the results through tools such as ChatGPT, Claude and Excel.

Meaningful answers depend on understanding the data. We encountered several cases where seemingly valid queries produced misleading results because of differences in financial reporting, missing information and changes to government organizations. We had to document these conventions and build appropriate rules into the data interface. Some of these issues also affected the traditional dashboards, reinforcing the importance of understanding the data regardless of how it’s accessed.

Flexible analysis doesn’t need unrestricted access to the database. The assistant worked through a fixed set of read-only operations over six models. The server enforces those limits itself, so they hold whatever the prompt says.

Each answer traces back to a logged query. The server logs every call with its arguments and caller, so anyone can rerun the query behind a figure. A chat over a pasted CSV can’t offer that, and a government that has to explain a figure needs it. The assistant’s reading of the results still needs checking.

Preparing the data was harder than connecting the AI. The MCP layer was the small part: about 3,300 lines of TypeScript, OAuth included, against about 13,700 for the screens and their API. Most of the effort went into reconciling the two datasets, finding their inconsistencies, and encoding the rules needed to read them correctly. That work is needed whichever assistant or protocol you choose.


GrantLedger is open source, including the importers, the MCP server, the web app, and the 12-question bank with its recorded answers. The full source code is on GitHub.

The project is a Next.js application with PostgreSQL that contains the web app, its API, the MCP server, and an import worker. Claude Desktop connects to the server over the stdio transport, and Claude Code connects over HTTP with a key. ChatGPT and claude.ai add the OAuth endpoint as a custom connector and sign in with Google.