sqlite.schema
The columns, indexes and foreign keys of a table (read only)
MCPCLI- Package
- @procedures/sqlite · README
- Path
["sqlite","schema"]- CLI
mark sqlite schema --table <string>- MCP tool
sqlite.schemaon thedev-toolsserver- As data
{"$proc":["sqlite","schema"],"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","schema"], { table: "<table>" });
console.log(JSON.stringify(result));From the command line
$ mark sqlite schema --table <string>
As data, in a program
{ "$proc": ["sqlite", "schema"], "input": { "table": "<table>" } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
table | string | yes | The table or the view | |
dbPath | string | no | The SQLite database file (default: the CLI log database, ~/logs/cli/cli.db) |
Output
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
table | string | yes | The table or the view | |
type | "table" | "view" | yes | table or view | |
sql | string | null | yes | The SQL that made the table or the view | |
columns | object[] | yes | The columns, in their order | |
indexes | object[] | yes | The indexes of the table | |
foreignKeys | object[] | yes | The foreign keys of the table |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"table": {
"type": "string",
"minLength": 1,
"description": "The table or the view"
},
"dbPath": {
"description": "The SQLite database file (default: the CLI log database, ~/logs/cli/cli.db)",
"type": "string",
"minLength": 1
}
},
"required": [
"table"
]
},
"output": {
"type": "object",
"properties": {
"table": {
"type": "string",
"description": "The table or the view"
},
"type": {
"type": "string",
"enum": [
"table",
"view"
],
"description": "table or view"
},
"sql": {
"description": "The SQL that made the table or the view",
"type": [
"string",
"null"
]
},
"columns": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The column"
},
"type": {
"type": "string",
"description": "The declared type, or \"\""
},
"notNull": {
"type": "boolean",
"description": "True for NOT NULL"
},
"defaultValue": {
"description": "The SQL of the default value, or null",
"type": [
"string",
"null"
]
},
"primaryKey": {
"type": "number",
"description": "The position of the column in the primary key, from 1, or 0"
}
},
"required": [
"name",
"type",
"notNull",
"defaultValue",
"primaryKey"
],
"additionalProperties": {}
},
"description": "The columns, in their order"
},
"indexes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The index"
},
"unique": {
"type": "boolean",
"description": "True for a unique index"
},
"origin": {
"type": "string",
"description": "\"c\": CREATE INDEX, \"u\": a UNIQUE constraint, \"pk\": the PRIMARY KEY"
},
"partial": {
"type": "boolean",
"description": "True for an index with a WHERE clause"
},
"columns": {
"type": "array",
"items": {
"type": "string"
},
"description": "The columns of the index, in order"
}
},
"required": [
"name",
"unique",
"origin",
"partial",
"columns"
],
"additionalProperties": {}
},
"description": "The indexes of the table"
},
"foreignKeys": {
"type": "array",
"items": {
"type": "object",
"properties": {
"from": {
"type": "string",
"description": "The column of this table"
},
"table": {
"type": "string",
"description": "The table that the key refers to"
},
"to": {
"description": "The column of that table, or null for its primary key",
"type": [
"string",
"null"
]
},
"onUpdate": {
"type": "string",
"description": "The action ON UPDATE"
},
"onDelete": {
"type": "string",
"description": "The action ON DELETE"
}
},
"required": [
"from",
"table",
"to",
"onUpdate",
"onDelete"
],
"additionalProperties": {}
},
"description": "The foreign keys of the table"
}
},
"required": [
"table",
"type",
"sql",
"columns",
"indexes",
"foreignKeys"
],
"additionalProperties": {}
}
}