SQL Server Table Assistant logo

SQL Server Table Assistant

by hblaDCOM

This application allows you to interact with a specific SQL Server table using natural language. It leverages the Modal Context Protocol to facilitate communication between LLMs and your data source.

View on GitHub

Last updated: N/A

What is SQL Server Table Assistant?

SQL Server Table Assistant is an application that enables users to interact with a specific SQL Server table using natural language. It utilizes the Modal Context Protocol (MCP) to translate natural language queries into SQL queries, allowing for a more intuitive data interaction experience.

How to use SQL Server Table Assistant?

To use the application, clone the repository, install the dependencies, set up the environment variables (including Azure OpenAI and SQL Server credentials), and run the client script. You can then type your questions about the table in plain English, and the assistant will generate and execute SQL queries based on your input. You can provide feedback to refine the queries and view the results in a formatted table.

Key features of SQL Server Table Assistant

  • Talk to Your Table: Chat with a specific SQL Server table using plain English

  • SQL Query Iteration: Provide feedback to refine SQL queries until they meet your needs

  • Beautiful Tabular Results: View query results in well-formatted tables for better readability

  • Query History Logging: Automatically save queries, iterations, and results for future reference

  • No-Code Table Operations: Query, insert, update, and delete data through natural conversations

  • Secure, Limited Access: Connect to only one table with restricted credentials for enhanced security

  • MCP-Enhanced Accuracy: Achieve precise table interactions through Modal Context Protocol

  • Context-Aware Conversations: Maintain context across multiple queries

  • Natural Language Explanations: Get plain English explanations of query results

  • Token Optimization: Smart caching and context management to minimize API usage

Use cases of SQL Server Table Assistant

  • Quickly retrieve data from a SQL Server table without writing SQL queries.

  • Allow non-technical users to access and manipulate data in a SQL Server table.

  • Automate data extraction and reporting tasks using natural language commands.

  • Build custom data analysis tools that can be easily used by anyone.

FAQ from SQL Server Table Assistant

What is Modal Context Protocol (MCP)?

MCP is a methodology that standardizes how context is bound to LLMs, providing a standard way to connect AI models to different data sources and tools.

Why use Single Table Mode?

Single Table Mode enhances security by limiting access to a single table, simplifies permissions, provides a focused experience, and reduces the risk of accidental access to sensitive data in other tables.

How does the application optimize token usage?

The application uses smart schema summarization, response caching, minimal prompt design, conversation management, dedicated system prompts, selective result transmission, and token parameter tuning to minimize token usage.

What are the prerequisites for using this application?

You need Python 3.12+, a valid Azure OpenAI deployment with API access, SQL Server with a table, and limited user credentials with access to only that table.

What special commands are available?

The application includes /diagnose to run table access diagnostics, /refresh_schema to refresh the table schema, and /history to view a list of all queries executed in the current session.