query_database
Run SQL against a Neverwinter Nights SQLite database to inspect or modify campaign data, returning rows for SELECT/PRAGMA or change summaries for INSERT/UPDATE/DELETE.
Instructions
Run a SQL statement against a NWN SQLite database. Returns rows for SELECT/PRAGMA, or change summary for INSERT/UPDATE/DELETE. Database name can omit the .sqlite3 extension. The main table is 'db' with columns: varname (varchar), playerid (varchar), vartype (tinyint), payload (blob), compressed (bool). vartype codes (ASCII char): 70='F' float, 73='I' int, 74='J' json (SetCampaignJson), 76='L' location (areaId@x:y;z!facing), 79='O' object (StoreCampaignObject, GFF JSON), 83='S' string, 86='V' vector. F/I/L/V are uncompressed ASCII. J/O/S are CPDB/zstd compressed. Compressed rows use CPDB/zstd format — use read_database_object to deserialize blobs.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"database": "<database>",
"sql": "<sql>"
},
"name": "query_database"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL statement to execute. Use PRAGMA table_info(tablename) to inspect schema. | |
| limit | No | Max rows to return for SELECT queries (default 500) | |
| params | No | JSON array of bind parameters (e.g. '["value1", 42]') | |
| database | Yes | Database filename (e.g. 'mymodule' or 'mymodule.sqlite3') |