Development
Beautify or minify SQL with full control over dialect (PostgreSQL, MySQL, SQLite, SQL Server/T-SQL, BigQuery, Snowflake, and more), keyword / identifier / function casing, indent style (standard, tabular-left, tabular-right), and spacing between statements. Produces a syntax-highlighted, copy-ready result with live size and statement stats.
Call this tool from your code in three languages.
curl -X POST 'https://api.elysiatools.com/en/api/tools/sql-query-formatter' \
-H 'Content-Type: application/json' \
-d '{"sql":"select u.id,u.name,count(o.id) as orders from users u left join orders o on o.user_id=u.id where u.active=1 and u.created_at > '\''2024-01-01'\'' group by u.id,u.name having count(o.id) > 5 order by orders desc;","mode":"format","language":"postgresql","keywordCase":"upper","identifierCase":"preserve","functionCase":"preserve","indentStyle":"standard","tabWidth":2,"linesBetween":1,"newlineBeforeSemicolon":false}'Send a POST request with your inputs as JSON. File parameters require a separate upload first.
POST https://api.elysiatools.com/en/api/tools/sql-query-formatter| Name | Type | Required | Description |
|---|---|---|---|
| sql | textarea | Yes | — |
| mode | select | No | — |
| language | select | No | — |
| keywordCase | select | No | — |
| identifierCase | select | No | — |
| functionCase | select | No | — |
| indentStyle | select | No | — |
| tabWidth | number | No | — |
| linesBetween | number | No | — |
| newlineBeforeSemicolon | checkbox | No | — |
HTML result
{
"result": "<div>Processed HTML content</div>",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}Add this tool to your Model Context Protocol server so AI agents can list and call it.
Add this block to your MCP client configuration:
{
"mcpServers": {
"elysiatools-sql-query-formatter": {
"name": "sql-query-formatter",
"description": "Beautify or minify SQL with full control over dialect (PostgreSQL, MySQL, SQLite, SQL Server/T-SQL, BigQuery, Snowflake, and more), keyword / identifier / function casing, indent style (standard, tabular-left, tabular-right), and spacing between statements. Produces a syntax-highlighted, copy-ready result with live size and statement stats.",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=sql-query-formatter",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}After connecting to the SSE endpoint, list the exposed tools:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoke the tool by its id, passing arguments built from its parameters:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "sql-query-formatter",
"arguments": {
"sql": "select u.id,u.name,count(o.id) as orders from users u left join orders o on o.user_id=u.id where u.active=1 and u.created_at > '2024-01-01' group by u.id,u.name having count(o.id) > 5 order by orders desc;",
"mode": "format",
"language": "postgresql",
"keywordCase": "upper",
"identifierCase": "preserve",
"functionCase": "preserve",
"indentStyle": "standard",
"tabWidth": 2,
"linesBetween": 1,
"newlineBeforeSemicolon": false
}
}
}Questions or issues? Contact [email protected]