SQL Agent Studio is an "Agent-First" IDE fork of VS Code OSS, custom-engineered to modernize SQL Server database management, schema visualization, and unit testing. Moving beyond simple sidebar chat boxes, SQL Agent Studio places an autonomous AI agent at the absolute center of the database development experience through a unified visual workspace and robust Model Context Protocol (MCP) server integration.
SQL Agent Studio utilizes a Decoupled Agent-Host Architecture. The user interface communicates with custom extensions embedded inside VS Code OSS, which spin up internal MCP servers to expose schema discovery, semantic search, and unit testing capabilities directly to local LLMs (Ollama / Phi3) or cloud APIs (Gemini 3 Flash & Pro).
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VS Code OSS Shell β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Mission Control UI β β
β ββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββ β
βββββ²βββββββββββββββββββββββββββββββββββββββββββββββββ²ββββ
β β β
β SSE Event Streams β Tool Calls & JSON-RPC β MCP Tools
β βΌ β
βββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββ
β Agent Orchestrator β
β (Gemini / Ollama / Phi3) β
βββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β SQL Context ββ SQL Rely ββ SQL Visualize β
β (Metadata) ββ (Testing) ββ (Canvas) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
SQL Agent Studio adds four custom VS Code extensions to the default VS Code OSS distribution, each enhancing a specific aspect of agent-driven SQL development.
The central orchestrator that exposes the visual "Mission Control" canvas inside the IDE.
- Reasoning Graph (React Flow / D3): A live node-based visualization mapping the Agent's thought process (
Intent NodeβContext NodeβPlan NodeβExecution NodeβValidation Node). - 5-Step Implementation Plans: Every write operation is wrapped in a strict plan structure requiring:
- Technical/Business Summary
- Prerequisites & Permissions
- T-SQL Execution Script
- Automated Validation Queries
- Rollback Blocks
- State Machine & Clarification Interlock: Pauses execution and displays a multi-choice clarification card in Mission Control if intent certainty drops below 90%.
- Hardened Prompting: Enforces strict tool-calling behaviors and bans unauthorized manual transaction blocks (e.g., ghost
BEGIN/COMMIT TRANSACTIONloops).
Handles AI-powered database documentation, metadata retrieval, and business context editing.
- Interactive Database Encyclopedia: A visual, collapsible hierarchy outlining databases, tables, views, procedures, and columns.
- Surgical Per-Column AI Generation: Enables users to select individual columns and generate descriptive metadata with AI.
- Batch Document Database: An automated loop that documents whole tables or schemas. Features a Batch Review UI allowing the user to select AI providers, review generated text, and cancel or pause.
- DB-Level Persistence: Synchronizes documentation directly with the database's
MS_Descriptionextended properties. - Semantic Object Search: Operates an active indexer allowing the Agent to search for database objects based on natural language intent (e.g., searching for "financial transactions" instead of knowing specific table names).
A native database unit testing suite integrated directly with the VS Code Testing UI and exposed to the AI Agent.
- tSQLt Framework Integration: Auto-installs tSQLt schemas, creates test classes, and scaffolds test procedures.
- SQLCop Guardrails: Integrates SQLCop tests to analyze schemas for performance, security leaks, and syntax vulnerabilities.
- Database-Aware Test Running: Exposes a hardened, connection-aware API allowing tests to execute against specific selected databases rather than relying strictly on the active text editor.
- JSON-Piped Output: Test results are formatted and returned as structured JSON payloads, allowing the AI Agent to process failures and success logs with precision.
A webview canvas allowing developers to visually map tables, join conditions, and build queries.
- Dependency Explorer: A React Flow interactive view mapping active schemas and schema dependencies.
- Ghost Joins (Inferred Relationships): Uses column-naming heuristics (e.g., matching column suffixes like
IDandCodewith identical types) to infer and display suggested joins. Includes a check toggle to hide or show suggestions. - Auto-Layout Engine: Supports both hierarchical (Directed Acyclic Graph layout ignoring ghost joins to avoid clutter) and circular layouts.
- Type-Safe Joins: Validates data types upon dragging visual connections, rejecting invalid joins with direct warning messages.
- Workspace Persistence: Allows saving and loading full canvas designs as
.sqlvizfiles (Ctrl+Shift+SandCtrl+O).
To allow the autonomous AI Agent to work seamlessly, both sql-context and sql-rely expose standard Model Context Protocol (MCP) tool APIs:
get_database_context: Reads global business rules from.sqlcontext.md.update_database_context: Rewrites or appends business guidelines.get_object_documentation: Retrieves database descriptions/metadata.get_schema: Obtains DDL structure for tables, views, and procedures.apply_documentation: Commits documentation back toMS_Description.search_objects: Searches database objects via semantic matching.
run_sql_tests: Runs all unit tests.run_sql_test: Executes a specific test procedure.list_sql_tests: Lists all unit test classes and test cases.create_test_class: Generates a new tSQLt test class (schema).create_sql_test: Generates a template for a new tSQLt test.deploy_sql_test: Deploys a tSQLt test procedure to the database.install_sqlcop: Installs SQLCop test rules.
- PII Scrubbing: RegEx-based local filters automatically mask emails and phone numbers in query results before they leave the environment for AI processing.
- Transactional Sandbox: All write actions proposed by the Agent default to a
BEGIN TRANSACTIONblock, enabling risk-free simulation and direct rollback functionality. - Impact Guardrail: Before executing destructive
UPDATEorDELETEstatements, the Agent is forced to execute aSELECT COUNT(*)pre-flight check to inform the user of the scope of modification.
Follow this guide to clone, compile, and run the SQL Agent Studio codebase.
Ensure you have the following installed on your machine:
- Node.js (v20+ recommended) & npm (included with Node.js)
- SQL Server Instance (Local SQL Express, Developer Edition, or Azure SQL database)
- Ollama (for local AI inference with Phi3 or similar LLMs)
- Git (for code collaboration)
Clone the repository and enter the workspace:
git clone https://github.com/ZEUSXXIV/SQL-Agent-Studio.git
cd SQL-Agent-StudioInstall dependencies for the custom VS Code OSS IDE distribution:
cd vscode-oss
npm installSQL Agent Studio features four custom extensions under vscode-oss/extensions/. Each must be compiled for the editor to run properly:
-
SQL Agent Studio (Mission Control):
cd vscode-oss/extensions/sql-agent-studio npm install npm run compile -
SQL Context (Metadata & Search):
cd vscode-oss/extensions/sql-context npm install npm run compile -
SQL Rely (Database Testing):
cd vscode-oss/extensions/sql-rely npm install npm run compile -
SQL Visualize (Dependency Explorer):
cd vscode-oss/extensions/sql-visualize npm install npm run compile
Optional: Alternatively, you can use npm run watch in any of these extension folders to enable hot-recompiling during active development.
To run or test the standalone React user interface components:
cd agent-ui
npm install
npm run devStart the compiled custom editor from the vscode-oss folder:
- Windows (Command Prompt / PowerShell):
cd vscode-oss .\scripts\code.bat
- macOS / Linux:
cd vscode-oss ./scripts/code.sh
- Ollama Integration: Ensure Ollama is running and download the default local model:
ollama run phi3
- Database Schema Setup:
- Open the newly launched editor and open a
.sqlfile to activate database connections. - Click Disconnected in the status bar (or use
Ctrl+Shift+PβMS SQL: Connect) to connect to your SQL Server instance. - Click the Test Explorer beaker icon (
βοΈ) in the left Activity Bar. - Run the command palette command
SQL Rely: Install tSQLt Frameworkfollowed bySQL Rely: Install SQLCop Teststo deploy testing frameworks directly to your target database.
- Open the newly launched editor and open a