← All procedures
db.query
Execute a SQL SELECT query
MCPCLI- Package
- @procedures/sqlite · README
- Path
["db","query"]- CLI
mark db query --sql <string>- MCP tool
db.query on the dev-tools server- As data
{"$proc":["db","query"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/sqlite"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["db","query"], { sql: "<sql>" });
console.log(JSON.stringify(result));From the command line
$ mark db query --sql <string>
As data, in a program
{ "$proc": ["db", "query"], "input": { "sql": "<sql>" } }Input
| Field | Type | Required | Default | Description |
|---|
sql | string | yes | | The SQL query (SELECT) |
params | any[] | no | | The values of the ? placeholders of the SQL, in order |
dbPath | string | no | | The SQLite database file (default: /home/runner/logs/cli/cli.db). A query does not make a missing file. |
Output
| Field | Type | Required | Default | Description |
|---|
columns | string[] | yes | | The column names |
rows | object[] | yes | | The rows, one object for each row |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"sql": {
"type": "string",
"description": "The SQL query (SELECT)"
},
"params": {
"description": "The values of the ? placeholders of the SQL, in order",
"type": "array",
"items": {}
},
"dbPath": {
"description": "The SQLite database file (default: /home/runner/logs/cli/cli.db). A query does not make a missing file.",
"type": "string"
}
},
"required": [
"sql"
]
},
"output": {
"type": "object",
"properties": {
"columns": {
"type": "array",
"items": {
"type": "string"
},
"description": "The column names"
},
"rows": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "The rows, one object for each row"
}
},
"required": [
"columns",
"rows"
],
"additionalProperties": {}
}
}