🛠️ MCP Tools Documentation

Detailed reference for all available SQL Server MCP tools

Version 1.7.2 • 16 Tools Available

📋 Table of Contents

execute_query

Execute a SQL query on the connected SQL Server database

📝 Parameters

Parameter Type Required Description
query string REQUIRED The SQL query to execute
database string OPTIONAL Optional: Database name to use for this query

💡 Examples

🔹 Basic Usage

{ "tool": "execute_query", "arguments": { "query": "SELECT * FROM your_table" } }

🔸 Advanced Usage

{ "tool": "execute_query", "arguments": { "query": "SELECT * FROM your_table", "database": "MyDatabase" } }

list_databases

List all databases on the SQL Server instance

📝 Parameters

No parameters required

💡 Examples

🔹 Usage

{ "tool": "list_databases", "arguments": {} }

list_tables

List all tables in a specific database

📝 Parameters

Parameter Type Required Description
database string OPTIONAL Database name (optional, uses current database if not specified)
schema string OPTIONAL Schema name (optional, defaults to dbo)

💡 Examples

🔸 Advanced Usage

{ "tool": "list_tables", "arguments": { "database": "MyDatabase", "schema": "dbo" } }

describe_table

Get the schema information for a specific table

📝 Parameters

Parameter Type Required Description
table_name string REQUIRED Name of the table to describe
database string OPTIONAL Database name (optional)
schema string OPTIONAL Schema name (optional, defaults to dbo)

💡 Examples

🔹 Basic Usage

{ "tool": "describe_table", "arguments": { "table_name": "your_table_name" } }

🔸 Advanced Usage

{ "tool": "describe_table", "arguments": { "table_name": "your_table_name", "database": "MyDatabase", "schema": "dbo" } }

list_foreign_keys

List all foreign key relationships in a schema

📝 Parameters

Parameter Type Required Description
database string OPTIONAL Database name (optional)
schema string OPTIONAL Schema name (optional, defaults to dbo)

💡 Examples

🔸 Advanced Usage

{ "tool": "list_foreign_keys", "arguments": { "database": "MyDatabase", "schema": "dbo" } }

get_table_data

Get sample data from a table with optional filtering and limiting

📝 Parameters

Parameter Type Required Description
table_name string REQUIRED Name of the table
database string OPTIONAL Database name (optional)
schema string OPTIONAL Schema name (optional, defaults to dbo)
limit number OPTIONAL Maximum number of rows to return (optional, defaults to 100)
where string OPTIONAL WHERE clause conditions (optional)

💡 Examples

🔹 Basic Usage

{ "tool": "get_table_data", "arguments": { "table_name": "your_table_name" } }

🔸 Advanced Usage

{ "tool": "get_table_data", "arguments": { "table_name": "your_table_name", "database": "MyDatabase", "schema": "dbo", "limit": 50, "where": "id > 100" } }

export_table_csv

Export table data in CSV format

📝 Parameters

Parameter Type Required Description
table_name string REQUIRED Name of the table to export
database string OPTIONAL Database name (optional)
schema string OPTIONAL Schema name (optional, defaults to dbo)
limit number OPTIONAL Maximum number of rows to export (optional)
where string OPTIONAL WHERE clause conditions (optional)

💡 Examples

🔹 Basic Usage

{ "tool": "export_table_csv", "arguments": { "table_name": "your_table_name" } }

🔸 Advanced Usage

{ "tool": "export_table_csv", "arguments": { "table_name": "your_table_name", "database": "MyDatabase", "schema": "dbo", "limit": 50, "where": "id > 100" } }

get_performance_stats

Get overall performance statistics and health summary

📝 Parameters

Parameter Type Required Description
timeframe string OPTIONAL Time period for stats:

💡 Examples

🔸 Advanced Usage

{ "tool": "get_performance_stats", "arguments": { "timeframe": "optional_value" } }

get_query_performance

Get detailed query performance breakdown by tool

📝 Parameters

Parameter Type Required Description
limit number OPTIONAL Maximum number of queries to analyze (optional, defaults to 50)
tool_filter string OPTIONAL Filter by specific MCP tool name (optional)
slow_only boolean OPTIONAL Only return slow queries (optional, defaults to false)

💡 Examples

🔸 Advanced Usage

{ "tool": "get_query_performance", "arguments": { "limit": 50, "tool_filter": "optional_value", "slow_only": true } }

get_connection_health

Get connection pool health metrics and diagnostics

📝 Parameters

No parameters required

💡 Examples

🔹 Usage

{ "tool": "get_connection_health", "arguments": {} }

explain_query

Get the execution plan for a SQL query to analyze performance

📝 Parameters

Parameter Type Required Description
query string REQUIRED The SQL query to analyze
database string OPTIONAL Optional: Database name to use for this query
include_actual_plan boolean OPTIONAL Include actual execution statistics (optional, defaults to false)

💡 Examples

🔹 Basic Usage

{ "tool": "explain_query", "arguments": { "query": "SELECT * FROM your_table" } }

🔸 Advanced Usage

{ "tool": "explain_query", "arguments": { "query": "SELECT * FROM your_table", "database": "MyDatabase", "include_actual_plan": true } }

analyze_query_performance

Analyze query performance and provide optimization suggestions

📝 Parameters

Parameter Type Required Description
query string REQUIRED SQL query to analyze for performance optimization
database string OPTIONAL Database name (optional)

💡 Examples

🔹 Basic Usage

{ "tool": "analyze_query_performance", "arguments": { "query": "SELECT * FROM your_table" } }

🔸 Advanced Usage

{ "tool": "analyze_query_performance", "arguments": { "query": "SELECT * FROM your_table", "database": "MyDatabase" } }

get_index_recommendations

Get index recommendations for database optimization

📝 Parameters

Parameter Type Required Description
database string OPTIONAL Database name (optional)
schema string OPTIONAL Schema name (optional, defaults to dbo)
limit number OPTIONAL Maximum number of recommendations to return (optional, defaults to 10)
impact_threshold number OPTIONAL Minimum impact score threshold (0-100, optional)

💡 Examples

🔸 Advanced Usage

{ "tool": "get_index_recommendations", "arguments": { "database": "MyDatabase", "schema": "dbo", "limit": 50, "impact_threshold": 1 } }

detect_query_bottlenecks

Detect and analyze query bottlenecks in the database

📝 Parameters

Parameter Type Required Description
database string OPTIONAL Database name (optional)
limit number OPTIONAL Maximum number of bottlenecks to return (optional, defaults to 10)
severity_filter string OPTIONAL Filter by severity level: LOW, MEDIUM, HIGH, CRITICAL (optional)

💡 Examples

🔸 Advanced Usage

{ "tool": "detect_query_bottlenecks", "arguments": { "database": "MyDatabase", "limit": 50, "severity_filter": "optional_value" } }

get_optimization_insights

Get comprehensive database optimization insights and health analysis

📝 Parameters

Parameter Type Required Description
database string OPTIONAL Database name (optional)
analysis_period string OPTIONAL Analysis time period: 24_HOURS, 7_DAYS, 30_DAYS (optional, defaults to 7_DAYS)

💡 Examples

🔸 Advanced Usage

{ "tool": "get_optimization_insights", "arguments": { "database": "MyDatabase", "analysis_period": "optional_value" } }

get_server_info

Get MCP server configuration, status, and logging information

📝 Parameters

Parameter Type Required Description
include_logs boolean OPTIONAL Include recent log entries (optional, defaults to false)

💡 Examples

🔸 Advanced Usage

{ "tool": "get_server_info", "arguments": { "include_logs": true } }