AAI SDK
    Preparing search index...

    Type Alias Db

    SQL database handle available to tool execute code when storage is enabled for the app. Backed by the app's Supabase Postgres schema.

    import type { ToolContext } from "@alexkroman1/aai";
    declare const ctx: ToolContext; // the context a tool's execute receives

    await ctx.db.query("insert into notes (body) values ($1)", ["hello"]);
    const rows = await ctx.db.query<{ body: string }>("select body from notes");
    type Db = {
        query<T = Record<string, unknown>>(
            sql: string,
            params?: unknown[],
        ): Promise<T[]>;
    }
    Index
    • Run one parameterized SQL statement ($1, $2… placeholders). Resolves with the result rows.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • sql: string
      • Optionalparams: unknown[]

      Returns Promise<T[]>