AskSQL API Reference (core v0.10.0)
    Preparing search index...

    Interface AskSqlServerConfig

    interface AskSqlServerConfig {
        audit?: AuditSink;
        auth: AuthHook;
        connectors: readonly Connector[];
        dynamicConnections?: DynamicConnectionOptions;
        engine: Omit<AskSqlConfig, "connectors" | "history">;
        maxBodyBytes?: number;
        mongoConnectors?: readonly MongoConnector[];
        onError?: (err: unknown, context: ErrorContext) => void;
        requireLoopbackHost?: boolean;
        suggestFixOnError?: boolean;
    }
    Index
    audit?: AuditSink
    auth: AuthHook

    Identity + scope resolver. Required - there is no anonymous default.

    connectors: readonly Connector[]

    All SQL connections the server can reach (with credentials).

    dynamicConnections?: DynamicConnectionOptions
    engine: Omit<AskSqlConfig, "connectors" | "history">

    Engine settings shared by all requests (model, policy, pruner, llm).

    maxBodyBytes?: number

    Max request body bytes. Default 64 KB.

    mongoConnectors?: readonly MongoConnector[]

    MongoDB connections. Separate because Mongo is not a SQL Connector.

    onError?: (err: unknown, context: ErrorContext) => void

    Called for every error the server turns into a response, so a host can log it; the wire response never carries internal detail. Best-effort: a throw from the hook is swallowed.

    requireLoopbackHost?: boolean

    Reject any request whose Host is not loopback. The CLI sets this for a loopback bind, where a non-loopback Host is a DNS-rebinding attempt; a hosted deployment leaves it off and uses CORS.

    suggestFixOnError?: boolean

    On a database error, ask the model for a corrected query and return it as suggestedSql for the user to review and re-run. Costs one extra model call per failure. Default: true.