Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Firebase

Scalekit connector
Open markdown

The Firebase connector lets your AI agent act in each user's Firebase account. Each user signs in to Firebase once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 17 tools.

Tools
17
What they doRead · write · destructive
10 · 5 · 210 read5 write2 destructive
Users sign in with
OAuth app
Your own Firebase app

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 Firebase connection

    In AgentKit > Connections, create a Firebase connection and copy its redirect URI. The name you give it is the connection_name your code passes. See Configure connections.

  4. Register an OAuth app

    Firebase connections use your own OAuth app. Register one with Firebase and add the redirect URI you copied.

    Then enter the app's Client ID and Client Secret on the Firebase connection.

  5. 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 = 'firebase'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Firebase:', 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: 'firebase_auth_user_lookup',
    toolInput: { project_id: 'my-app-12345' },
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • firebase_auth_user_lookupLook up Firebase Auth users by UID, email address or phone number.Read-only

    Look Up Users

    Look up Firebase Auth users by UID, email address or phone number. Returns users, an array of matching accounts with localId, email, emailVerified, displayName, phoneNumber, disabled, providerUserInfo, customAttributes, createdAt and lastLoginAt. Use this when you know a user's UID, email or phone. Use firebase_auth_users_list to page through every user, and firebase_auth_users_query to sort or count users.

    Inputs

    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
    emailsarray
    Email addresses of the users to fetch. Provide at least one of uids, emails or phone_numbers. Example: ["alice@example.com"].
    phone_numbersarray
    Phone numbers of the users to fetch, in E.164 format. Provide at least one of uids, emails or phone_numbers. Example: ["+15555550100"].
    tenant_idstring
    The Identity Platform tenant ID the user belongs to. Only set this when the project uses multi-tenancy; leave it empty for a standard Firebase Auth project. Example: tenant-a1b2c.
    uidsarray
    UIDs (localId values) of the users to fetch. Provide at least one of uids, emails or phone_numbers. Example: ["5DxHkA3f9yTn2pQeLr7Wb1cZ0sU2"].
  • firebase_auth_users_listList all Firebase Auth users in a project, one page at a time, in UID order.Read-only

    List Users

    List all Firebase Auth users in a project, one page at a time, in UID order. Returns users (each with localId, email, displayName, phoneNumber, disabled, providerUserInfo, createdAt and lastLoginAt) and a nextPageToken when more pages exist. Use this to browse or export every user. Use firebase_auth_user_lookup when you know a UID, email or phone, and firebase_auth_users_query to sort or count users.

    Inputs

    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
    max_resultsinteger
    The maximum number of users to return in this page, from 1 to 1000. Defaults to 20. Example: 100.
    next_page_tokenstring
    The nextPageToken from a previous call, to fetch the following page. Example: 5DxHkA3f9yTn2pQeLr7Wb1cZ0sU2.
    tenant_idstring
    The Identity Platform tenant ID the user belongs to. Only set this when the project uses multi-tenancy; leave it empty for a standard Firebase Auth project. Example: tenant-a1b2c.
  • firebase_auth_users_queryQuery Firebase Auth users with sorting and offset paging, optionally filtered by an exact email, UID or phone number, or just count them.Read-only

    Query Users

    Query Firebase Auth users with sorting and offset paging, optionally filtered by an exact email, UID or phone number, or just count them. Returns recordsCount and, unless return_user_info is false, userInfo with the matching accounts. Use this to sort users (for example by creation or last sign-in time) or to count them. Use firebase_auth_users_list for simple paging through every user, and firebase_auth_user_lookup to fetch known users.

    Inputs

    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
    emailstring
    Only match the user with this email address (case-insensitive). Set at most one of email, uid or phone_number. Example: alice@example.com.
    limitinteger
    The maximum number of users to return, up to 500. Defaults to 500. Example: 50.
    offsetinteger
    How many matching users to skip before returning results, for paging. Example: 50.
    orderstring
    Sort direction, ASC or DESC. Defaults to ASC. Example: DESC.one of ASCDESC
    phone_numberstring
    Only match the user with this phone number, in E.164 format. Set at most one of email, uid or phone_number. Sorting is ignored with this filter. Example: +15555550100.
    return_user_infoboolean
    If false, only the number of matching users is returned, not the users themselves. Defaults to true. Example: false.
    sort_bystring
    The field to sort by. One of USER_ID, NAME, CREATED_AT, LAST_LOGIN_AT or USER_EMAIL. Defaults to USER_ID. Example: CREATED_AT.one of USER_IDNAMECREATED_ATLAST_LOGIN_ATUSER_EMAIL
    tenant_idstring
    The Identity Platform tenant ID the user belongs to. Only set this when the project uses multi-tenancy; leave it empty for a standard Firebase Auth project. Example: tenant-a1b2c.
    uidstring
    Only match the user with this UID. Set at most one of email, uid or phone_number. Example: 5DxHkA3f9yTn2pQeLr7Wb1cZ0sU2.
  • firebase_firestore_aggregation_query_runCount, sum or average the documents that match a Cloud Firestore structured query, without returning the documents.Read-only

    Run Aggregation Query

    Count, sum or average the documents that match a Cloud Firestore structured query, without returning the documents. Returns an array whose result entry holds aggregateFields, one value per alias, plus a readTime. Use this for totals such as how many documents match. Use firebase_firestore_query_run to get the matching documents themselves.

    Inputs

    aggregationsarrayrequired
    One to five aggregations to compute. Each has an optional alias that names the result, and exactly one of count (an empty object, or upTo to stop counting early), sum or avg (each naming the numeric field to aggregate). Example: [{"alias": "total", "count": {}}, {"alias": "revenue", "sum": {"field": {"fieldPath": "amount"}}}].
    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
    structured_queryobjectrequired
    A Firestore StructuredQuery object. from names the collection (set allDescendants to true to also match same-named subcollections at any depth); where holds a fieldFilter, compositeFilter or unaryFilter; orderBy, limit (which caps how many documents are aggregated), offset, select and startAt/endAt cursors are optional. Filter values use the same typed value objects as document fields. Example: {"from": [{"collectionId": "users"}], "where": {"fieldFilter": {"field": {"fieldPath": "age"}, "op": "GREATER_THAN_OR_EQUAL", "value": {"integerValue": "21"}}}, "orderBy": [{"field": {"fieldPath": "age"}, "direction": "DESCENDING"}], "limit": 20}.
    database_idstring
    The Firestore database ID. Most projects have only the default database, whose ID is (default). Use firebase_firestore_databases_list to see other databases. Example: (default).default (default)
    parent_pathstring
    Where to look, relative to the database. Use documents for the top level of the database, or documents/<document path> for the subcollections of one document. Example: documents or documents/users/alice.default documents
  • firebase_firestore_collection_ids_listList the IDs of the collections at the top level of a Cloud Firestore database or directly under one document.Read-only

    List Collection IDs

    List the IDs of the collections at the top level of a Cloud Firestore database or directly under one document. Returns collectionIds (an array of collection ID strings) and a nextPageToken when more pages exist. Use this to discover which collections exist before listing or querying documents. Use firebase_firestore_documents_list to see the documents inside a collection.

    Inputs

    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
    database_idstring
    The Firestore database ID. Most projects have only the default database, whose ID is (default). Use firebase_firestore_databases_list to see other databases. Example: (default).default (default)
    page_sizeinteger
    The maximum number of collection IDs to return in this page. Example: 100.
    page_tokenstring
    The nextPageToken from a previous call, to fetch the following page. Example: Y2hhdHJvb21z.
    parent_pathstring
    Where to look, relative to the database. Use documents for the top level of the database, or documents/<document path> for the subcollections of one document. Example: documents or documents/users/alice.default documents
  • firebase_firestore_databases_listList the Cloud Firestore databases in a Firebase project.Read-only

    List Firestore Databases

    List the Cloud Firestore databases in a Firebase project. Returns each database's resource name (projects/<project>/databases/<database_id>), type, location, and concurrency mode. Use this to find a database ID before calling the other firebase_firestore tools. Most projects only have the (default) database.

    Inputs

    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
  • firebase_firestore_document_getGet one Cloud Firestore document by its path.Read-only

    Get Document

    Get one Cloud Firestore document by its path. Returns the document's resource name, its fields as typed values, and its createTime and updateTime. Use this when you know the exact document path. Use firebase_firestore_documents_batch_get to fetch several known documents at once, and firebase_firestore_query_run to find documents by field values.

    Inputs

    document_pathstringrequired
    The document path relative to the database root, made of alternating collection and document IDs. Example: users/alice or users/alice/orders/order-123.
    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
    database_idstring
    The Firestore database ID. Most projects have only the default database, whose ID is (default). Use firebase_firestore_databases_list to see other databases. Example: (default).default (default)
    mask_field_pathsarray
    Field paths to return. When set, only these fields come back in each document; when empty, all fields are returned. Use dots for nested fields. Example: ["name", "address.city"].
  • firebase_firestore_documents_batch_getGet several Cloud Firestore documents by path in one request.Read-only

    Batch Get Documents

    Get several Cloud Firestore documents by path in one request. Returns an array with one entry per path: found holds the document, or missing holds the name of a document that does not exist. Use this when you already know two or more document paths. Use firebase_firestore_document_get for a single document.

    Inputs

    document_pathsarrayrequired
    The document paths to fetch, each relative to the database root (alternating collection and document IDs). Example: ["users/alice", "users/bob"].
    project_idstringrequired
    The Firebase project ID (the same as its Google Cloud project ID). Find it in the Firebase console under Project settings > General. Example: my-app-12345.
    database_idstring
    The Firestore database ID. Most projects have only the default database, whose ID is (default). Use firebase_firestore_databases_list to see other databases. Example: (default).default (default)
    mask_field_pathsarray
    Field paths to return. When set, only these fields come back in each document; when empty, all fields are returned. Use dots for nested fields. Example: ["name", "address.city"].