mcpdata Request an invite

Answers / Report with AI

How do I stop my AI making up numbers when analysing data?

Recipe verified on Ran on the public demo (read-only)
Short answer

Give it a database to query and ask it to answer only from query results. Numbers then come from the database (sums and counts over every row), and the tool call and its result are there to check, instead of figures the model estimated from text it read.

Steps

  1. Connect your assistant to the public demo. It's a read-only instance with 10 million synthetic orders, so you can try this before you have your own. In Claude Code:
    claude mcp add --transport http mcpdata-demo https://demo.mcpdata.org/mcp --header "Authorization: Bearer cdb_live_PkVoldus8qcE-hqffjajNZzQwiA7rTHMoR4RLSAxsCE"

    The key is public on purpose: it can only read the demo's sample data. For Claude Desktop, Cursor and other apps, see Connect your AI.

  2. Ask your question. Give your AI this prompt:
    Using mcpdata, what was total revenue in 2024 in Demo.Orders? Answer only from a query result and show the query you ran.
What your AI does: the tool call it makes for this prompt, and what came back
query(table_name="Demo.Orders", filters=[{"column": "order_year", "op": "eq", "value": 2024}], group_by=["order_year"], agg=[{"func": "sum", "column": "revenue", "alias": "revenue"}, {"func": "count", "column": "order_id", "alias": "orders"}]) → 1 row
What you should get · the recipe's real result from its last run
order_yearrevenueorders
20241,789,833,7313,339,853

Synthetic data: the demo's orders are generated, not real customers.

The assistant needs mcpdata connected (step 1) to run the query.

Why this works

Language models are good at language and unreliable at arithmetic over long text. When the database does the arithmetic, the model's job is to choose the query and report the result, and you can see both. The same question returns the same number every time.

Related questions