Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Glean

Scalekit connector
Open markdown

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

Tools
137
What they doRead · write · destructive
62 · 56 · 1962 read56 write19 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 Glean connection

    In AgentKit > Connections, create a Glean 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 = 'glean'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Glean:', 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: 'glean_agent_search',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Glean 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
  • glean_autocompleteSuggest query completions, search operators, and matching documents for a partially typed search query.Read-only

    Autocomplete

    Suggest query completions, search operators, and matching documents for a partially typed search query. Returns a ranked list of suggestions, each with a result type (e.g. document, operator, quicklink, app) and the display text/keywords for that suggestion. Use this to power type-ahead suggestions as a user types a query; use glean_search once the user submits a complete query. Requires a Glean connection with the target instance's domain and an API token.

    Inputs

    querystringrequired
    The partially typed query text to generate suggestions for. Example: "roadm".
    datasourcesarray
    Restrict suggestions to one or more datasources by their short name (e.g. gmail, slack, confluence, jira, github, gdrive). All datasources are considered if omitted. Example: ["slack", "confluence"].
    localestring
    The client's preferred locale in RFC 5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language header is used; if that's absent or unsupported, Glean defaults to the closest match or en.
    result_sizeinteger
    Maximum number of suggestions to return. Glean caps this at 200 if omitted. Example: 10.
    result_typesarray
    Restrict suggestions to one or more result types. Valid values: ADDITIONAL_DOCUMENT, APP, BROWSER_HISTORY, DATASOURCE, DOCUMENT, ENTITY, GOLINK, HISTORY, CHAT_HISTORY, NEW_CHAT, OPERATOR, OPERATOR_VALUE, QUICKLINK, SUGGESTION. All types may be returned if omitted. Example: ["DOCUMENT", "OPERATOR"].
  • glean_check_datasource_authCheck which of Glean's connected data sources still require the current user to complete per-user OAuth authorization.Read-only

    Check Datasource Auth

    Check which of Glean's connected data sources still require the current user to complete per-user OAuth authorization. Returns a list of unauthorized datasource instances, each with its display name, current auth status, and a relative URL to resume or start the OAuth flow. Use this before relying on datasource-restricted search or chat results to see which sources the user hasn't yet authorized; it only reports status and does not perform the authorization itself. Requires a Glean connection with the target Glean instance's domain and an API token.

    Inputs

    This tool takes no inputs.

  • glean_check_document_accessCheck whether a specific user has access to view a document in a custom Glean datasource, based on the document's uploaded permissions.Read-only

    Check Document Access

    Check whether a specific user has access to view a document in a custom Glean datasource, based on the document's uploaded permissions. Returns a single hasAccess boolean indicating whether the user can see the document in search results. Use this to verify permission configuration for one user/document pair; use glean_debug_get_document instead to inspect the document's full permissions record without testing a specific user. Requires a Glean connection with the target instance's domain and an API token with indexing access for the datasource.

    Inputs

    datasourcestringrequired
    The short name of the custom datasource the document belongs to, exactly as configured in Glean's datasource setup. Example: "myjira".
    doc_idstringrequired
    The document's unique ID within the datasource, exactly as it was set in the id field when the document was uploaded via the indexing API. Example: "TICKET-1234".
    object_typestringrequired
    The object type the document belongs to within the datasource's schema, exactly as it was set when the document was uploaded via the indexing API (e.g. "ticket", "issue", "page").
    user_emailstringrequired
    The email address of the user whose access to the document should be checked. Example: "jane@example.com".
  • glean_debug_get_datasource_statusRetrieve a comprehensive status snapshot for a Glean datasource: bulk upload history, document and identity upload/index counts by object type, and the datasource's visibility setting.Read-only

    Debug: Get Datasource Status

    Retrieve a comprehensive status snapshot for a Glean datasource: bulk upload history, document and identity upload/index counts by object type, and the datasource's visibility setting. Returns processing history for documents and identity data, counts of uploaded vs. indexed documents grouped by object type, and an enum showing whether the datasource is enabled for all users, a test group, or not enabled. Use this as the primary health check for a custom datasource's indexing pipeline instead of the deprecated glean_get_document_count and glean_get_user_count, which each return only a single count. Requires a Glean connection with the target instance's domain and an API token with indexing access for the datasource. This is a Beta endpoint and may change without notice.

    Inputs

    datasourcestringrequired
    The short name of the custom datasource to fetch debug status for, exactly as configured in Glean's datasource setup (visible in the Glean admin console). Example: "myjira".
  • glean_debug_get_documentLook up upload, indexing, and permission status for one document in a Glean datasource, identified by its object type and document ID.Read-only

    Debug: Get Document

    Look up upload, indexing, and permission status for one document in a Glean datasource, identified by its object type and document ID. Returns the document's upload and indexing status with timestamps, its permission-identity status, and the full uploaded-permissions record (allowed users, allowed groups, group intersections, and anonymous/all-datasource-users access flags). Use this beta diagnostic endpoint to debug why a specific document isn't appearing in search or has unexpected permissions; use glean_debug_get_documents to check many documents at once, or glean_get_document_status for the older, status-only equivalent. Requires a Glean connection with the target instance's domain and an API token with indexing access for the datasource. This is a Beta endpoint and may change without notice.

    Inputs

    datasourcestringrequired
    The short name of the custom datasource the document belongs to, exactly as configured in Glean's datasource setup. Example: "myjira".
    doc_idstringrequired
    The document's unique ID within the datasource, exactly as it was set in the id field when the document was uploaded via the indexing API. Example: "TICKET-1234".
    object_typestringrequired
    The object type the document belongs to within the datasource's schema, exactly as it was set when the document was uploaded via the indexing API (e.g. "ticket", "issue", "page").
  • glean_debug_get_document_eventsRetrieve the lifecycle event history (uploads, indexing, deletion requests, and deletions) for one document in a Glean datasource.Read-only

    Debug: Get Document Events

    Retrieve the lifecycle event history (uploads, indexing, deletion requests, and deletions) for one document in a Glean datasource. Returns a list of lifecycle events, each with an event type (UPLOADED, INDEXED, DELETION_REQUESTED, or DELETED) and a timestamp, covering the requested time window. Use this beta diagnostic endpoint to trace exactly when a document was uploaded, indexed, or removed; use glean_debug_get_document instead for the document's current status rather than its history. This endpoint is rate-limited to 1 request per minute per datasource. Requires a Glean connection with the target instance's domain and an API token with indexing access for the datasource. This is a Beta endpoint and may change without notice.

    Inputs

    datasourcestringrequired
    The short name of the custom datasource the document belongs to, exactly as configured in Glean's datasource setup. Example: "myjira".
    doc_idstringrequired
    The document's unique ID within the datasource, exactly as it was set in the id field when the document was uploaded via the indexing API. Example: "TICKET-1234".
    object_typestringrequired
    The object type the document belongs to within the datasource's schema, exactly as it was set when the document was uploaded via the indexing API (e.g. "ticket", "issue", "page").
    max_eventsinteger
    The maximum number of lifecycle events to return, up to 100. Defaults to 20 when omitted. Example: 50.
    start_datestring
    The earliest date to include lifecycle events from, as an ISO 8601 date or datetime. Cannot be more than 30 days in the past. Defaults to 7 days ago when omitted. Example: "2026-08-01".