Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Metabase

Scalekit connector
Open markdown

The Metabase connector lets your AI agent act in each user's Metabase account. Each user connects their own Metabase API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 77 tools.

Tools
77
What they doRead · write · destructive
42 · 30 · 542 read30 write5 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Metabase connection

    In AgentKit > Connections, create a Metabase connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'metabase'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Metabase:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'metabase_actions_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Metabase credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • metabase_action_getGet one action by ID.Read-only

    Get Action

    Get one action by ID. Returns id, name, type, model_id, parameters (the inputs it expects), and its query or implicit kind. Use this to see which parameters metabase_action_execute needs.

    Inputs

    action_idintegerrequired
    ID of the action, from metabase_actions_list.
  • metabase_actions_listList actions (saved inserts, updates, deletes, or custom SQL writes defined on models).Read-only

    List Actions

    List actions (saved inserts, updates, deletes, or custom SQL writes defined on models). Returns an array of actions with id, name, type, model_id, and parameters. Use metabase_action_execute to run one. Actions must be enabled on the database.

    Inputs

    model_idinteger
    Only actions defined on this model (card) ID.
  • metabase_card_dashboards_listList the dashboards that contain a card.Read-only

    List Card Dashboards

    List the dashboards that contain a card. Returns an array of {id, name} pairs. Use this before changing or deleting a card to see where it is used.

    Inputs

    card_idintegerrequired
    ID of the card (a saved question, model, or metric). Find it with metabase_search or metabase_cards_list.
  • metabase_card_getGet one card (saved question, model, or metric) by ID.Read-only

    Get Card

    Get one card (saved question, model, or metric) by ID. Returns the card's name, type, display, description, collection, parameters, visualization settings, and dataset_query. Use this to inspect a card's query before running or editing it; use metabase_card_query to get its results.

    Inputs

    card_idintegerrequired
    ID of the card (a saved question, model, or metric). Find it with metabase_search or metabase_cards_list.
    legacy_mbqlboolean
    Set to true to return dataset_query in the legacy MBQL 4 format (Metabase 57+ returns MBQL 5 by default). Useful when copying the query into a new card.
  • metabase_card_query_metadata_getGet the metadata needed to work with a card's query: its databases, tables, and fields.Read-only

    Get Card Query Metadata

    Get the metadata needed to work with a card's query: its databases, tables, and fields. Returns databases, tables (with fields and their types), and fields. Use this to learn which columns a card's query can filter or group by.

    Inputs

    card_idintegerrequired
    ID of the card (a saved question, model, or metric). Find it with metabase_search or metabase_cards_list.
  • metabase_cards_listList saved questions, models, and metrics (cards) the API key can see, optionally filtered.Read-only

    List Cards

    List saved questions, models, and metrics (cards) the API key can see, optionally filtered. Returns an array of cards with id, name, type, display, collection, database_id, and dataset_query. Use this to browse cards by filter; use metabase_search to find cards by name, and metabase_card_get for one card.

    Inputs

    fstring
    Which cards to return: all (default), mine, bookmarked, database, table, using_model, using_segment, or archived. The database, table, using_model, and using_segment filters need model_id.one of allminebookmarkeddatabasetableusing_modelusing_segmentarchived
    model_idinteger
    ID used by the filter: the database ID for f=database, the table ID for f=table, the model card ID for f=using_model, or the segment ID for f=using_segment.
  • metabase_collection_getGet one collection's details by ID, or the root collection with 'root'.Read-only

    Get Collection

    Get one collection's details by ID, or the root collection with 'root'. Returns id, name, description, location, effective_ancestors, can_write, and archived. Use metabase_collection_items_list to see what the collection contains.

    Inputs

    collection_idstringrequired
    ID of the collection, or 'root' for the root collection ('Our analytics').
  • metabase_collection_items_listList the items (questions, models, metrics, dashboards, sub-collections, and more) in a collection, with paging.Read-only

    List Collection Items

    List the items (questions, models, metrics, dashboards, sub-collections, and more) in a collection, with paging. Returns data (each item's id, name, model, description, and last-edit info), total, limit, and offset. Use this to browse a folder; use metabase_search to find items by name across all collections.

    Inputs

    collection_idstringrequired
    ID of the collection, or 'root' for top-level items.
    archivedboolean
    Set true to return archived (trashed) items instead of active ones.
    limitinteger
    Maximum number of items to return (page size).
    modelsarray
    Only return these item types: card (question), dataset (model), metric, dashboard, collection, pulse, snippet, timeline, document, table, or no_models. Leave empty for all types.
    offsetinteger
    Number of items to skip, for paging.
    pinned_statestring
    Pinned filter: all (default), is_pinned, or is_not_pinned.one of allis_pinnedis_not_pinned
    sort_columnstring
    Sort by name, last_edited_at, last_edited_by, model, or description.one of namelast_edited_atlast_edited_bymodeldescription
    sort_directionstring
    Sort direction: asc or desc.one of ascdesc