• LOGIC
  • METRIC
  • HUMAN
  • CLEAN

How to audit SQL logic with your AI agent

Connect Mode Analytics to your agent to inspect the code behind your dashboards. Once connected, your AI can scan queries and definitions to find mistakes.

Ask AI about this page

Short answer

How can I use AI to check my Mode Analytics SQL?

Your agent pulls specific queries and field definitions directly from Mode. It then compares that logic against your expected metric rules to spot discrepancies. You'll get a breakdown of where the code deviates from your requirements.

Where every issue lands.

Audit outcomes

The AI categorizes what it finds in your Mode workspace.

LOGIC

Broken SQL logic

The agent identifies syntax errors or flawed joins. You get a list of specific queries that won't run or return wrong data.

METRIC

Definition mismatches

The AI compares calculated field definitions to your business rules. It flags when a metric calculation doesn't match your documentation.

HUMAN

Manual review needed

When the AI finds ambiguous logic, it flags it for you. You decide if the code is actually wrong or just written in a way the agent doesn't recognize.

CLEAN

Verified code

The agent confirms that the SQL matches the intended metric. You receive a summary of queries that passed the audit.

The workflow

What your AI does when the audit starts.

The agent moves through your Mode workspace to gather the raw logic.

  1. Gather queries

    The agent scans your Mode workspace to find the specific SQL code used in your reports.

    list_mode_queries
  2. Check definitions

    It pulls the underlying logic for calculated fields to see how metrics are actually built.

    list_mode_definitions
  3. Inspect reports

    The agent looks at the specific report data to see if the output matches the query logic.

    get_mode_report
  4. Flag errors

    The agent compares the gathered data against your instructions and highlights the mismatches.

    list_mode_queries

Try it

Copy these to start.

Use these prompts to kick off an audit.

Starting points

Replace the bracketed text with your specific Mode report names or field titles.

Mode Analytics Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_SRi8OhPiH6AqqyQpnSFSA21WRVtjdvVcCqhb8EAY/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Mode Analytics capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "mode-analytics-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_SRi8OhPiH6AqqyQpnSFSA21WRVtjdvVcCqhb8EAY/mcp"
    }
  }
}
Copy into chat04
  • List all queries in my 'Marketing Dashboard' and check if the revenue calculation is correct.

  • Find the definition for the 'active_users' calculated field in the 'User Growth' report.

  • Audit the SQL in my 'Sales Performance' queries to ensure no duplicate joins are happening.

  • Compare the logic in my 'Monthly Churn' report against these business rules: [paste rules].

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Mode Analytics once, then ask.

Just link your account via the Vinkius dashboard. Your credentials stay encrypted, and you can immediately start asking your agent about your Mode data.

Connect Mode Analytics to your AI

FAQ

How the audit behaves

  • 01

    Can the AI change my SQL queries in Mode?

    No. The AI can only read your queries and definitions. You have to manually edit the code in Mode yourself.

  • 02

    Does the AI see all my Mode reports?

    The AI can see any report or query you give it permission to access through the connector tools.

  • 03

    Can the AI create new calculated fields for me?

    No. The agent can only list and inspect existing definitions. It cannot write new fields back to Mode.

  • 04

    How does the AI know if a metric is 'wrong'?

    The AI only knows if a metric is wrong if you provide the correct logic or business rules in your prompt to compare it against.

  • 05

    Will this work with my existing Mode dashboards?

    Yes, as long as the dashboard uses queries and calculated fields that the agent can access.

  • More questions about Mode Analytics? The Connector page answers them. See everything the Mode Analytics Connector can do

Connect Mode Analytics to Claude, Cursor, ChatGPT & more