Run analytical SQL queries over local CSV, Parquet, JSON, Arrow and DuckDB files using DuckDB in-process engine. Ideal for data exploration, aggregations and transformations without a database server.
duckdbsqlanalyticscsvparquetjsonolap
Input Parameters
Parameter
Type
Description
operationrequired
string
'query': run SQL; 'describe': stats summary of a file/table; 'sample': return first N rows; 'schema': column types of a file. One of: query, describe, sample, schema.
sqloptional
string
SQL query. Use read_csv('file.csv'), read_parquet('file.parquet'), read_json('file.json') in FROM clause to query files directly.
fileoptional
string
Path to a CSV, Parquet, JSON or DuckDB file (used for 'describe', 'sample', 'schema' operations).
Result as Markdown table or CSV string (when format != 'rows').
schema
array[object]
Column definitions with name and type.
stats
object
Descriptive statistics per column (describe operation).
Examples
Aggregate sales from a Parquet file
// Input
{
"operation": "query",
"sql": "SELECT region, SUM(amount) as total FROM read_parquet('/data/sales.parquet') GROUP BY region ORDER BY total DESC"
}
// Output
{
"operation": "query",
"row_count": 4,
"columns": [
"region",
"total"
],
"rows": [
{
"region": "North",
"total": 142500.0
}
]
}
Discovery hint: Install with ppm install mcp-duckdb or invoke remotely via POST /v1/invoke/mcp-duckdb on the MCP Service.
PascalAI Usage
uses toolslib;
var Tool := LoadTool('mcp-duckdb');
var R := Tool.Call(JsonObj(['operation','query','sql',"SELECT city, COUNT(*) as n FROM read_csv('/data/orders.csv') GROUP BY city ORDER BY n DESC LIMIT 10"]));
Writeln(R['formatted']);