Skip to main content
The MSSQLResourceClient provides query execution and schema discovery against Microsoft SQL Server databases.

Usage

import { myMssqlClient } from "./clients";

const result = await myMssqlClient.invoke(
  "SELECT * FROM users WHERE id = @p1",
  [123],
  "get-user"
);

if (result.ok) {
  console.log(result.result.rows);
}

Inputs

The invoke method accepts the following arguments:
sql
string
required
The SQL query string to execute. Use @p1, @p2, etc., for parameterized queries.
params
(string | number | boolean | null)[]
An array of values for the parameterized query.
invocationKey
string
required
A unique identifier for this operation, used for tracing and logging.
timeoutMs
number
Optional timeout in milliseconds for the query execution.

Outputs

On success (ok: true), the result object contains:
kind
"database"
Discriminator for the response type.
rows
Record<string, unknown>[]
An array of objects representing the rows returned by the query.
rowsAffected
number
The number of rows affected by the query.

Schema Discovery

The client supports listing schemas, tables, and columns for exploring your database structure.