← All procedures

sqlite.tableColumns

This function gives the names of the columns of a table, in the order of the table. A table that does not exist gives an empty list.

MCPCLI
Package
@procedures/sqlite · README
Path
["sqlite","tableColumns"]
CLI
mark sqlite tableColumns --db <object> --table <string>
MCP tool
sqlite.tableColumns on the dev-tools server
As data
{"$proc":["sqlite","tableColumns"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/sqlite/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["sqlite","tableColumns"], { db: {}, table: "<table>" });
console.log(JSON.stringify(result));

From the command line

$ mark sqlite tableColumns --db <object> --table <string>

As data, in a program

{
  "$proc": ["sqlite", "tableColumns"],
  "input": { "db": {}, "table": "<table>" }
}

Input

FieldTypeRequiredDefaultDescription
dbobjectyesThe connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it.
tablestringyesThe name of the table.

Output

The schema does not list fields (string[]).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "db": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "minLength": 1,
            "description": "The id of the handle. The procedure that opens the object gives it."
          }
        },
        "required": [
          "handle"
        ],
        "additionalProperties": false,
        "x-procedures-handle": "node:sqlite#DatabaseSync",
        "description": "The connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it."
      },
      "table": {
        "type": "string",
        "description": "The name of the table."
      }
    },
    "required": [
      "db",
      "table"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "string"
    }
  }
}