Skip to main content
Glama
shadow-dba

mssql-dba-mcp

by shadow-dba

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
IDLENoConnection pool idle timeout in ms.30000
DB_HOSTYesServer name or IP.
DB_NAMEYesDatabase to connect to. Database tools default to it.
DB_PORTNoServer port.1433
DB_USERYesLogin name.
ENCRYPTNoEncrypt the connection. Set to `false` only if the server has no TLS.true
MAX_POOLNoConnection pool maximum size.10
MIN_POOLNoConnection pool minimum size.0
DB_DOMAINNoWindows auth with a domain account only.
DB_PASSWORDYesLogin password.
DB_AUTH_TYPEYesAuthentication type: `sql` or `windows` (NTLM).
REQUEST_TIMEOUTNoQuery timeout in ms.30000
TRUST_SERVER_CERTIFICATENoSet to `true` to accept a self-signed certificate. Only on a trusted network.false
MSSQL_ALLOW_PRIVILEGED_LOGINNoSet to `true` to let the server run with a sysadmin, `CONTROL SERVER` or `db_owner` login, with a warning. Not recommended.false

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
mssql_server_versionA

Server version, edition, patch level (CU), collation, clustering/HADR and licensing. Call first in any health check.

mssql_server_timezoneA

Server time and timezone: local time, UTC time and UTC offset. Use for time-related job, backup or replication problems.

mssql_wait_statsA

Wait statistics: the top wait types (what the server waits on: CPU, I/O, locks, memory), each as % of all waits, with average wait and signal (CPU) %. Idle waits are excluded. sampleSeconds=0 (default): since the last restart. sampleSeconds=5: only waits during a 5-second sample, the "what is slow right now" view.

mssql_top_queriesA

Top queries by CPU, logical reads, memory grant, spills, duration or executions, from the plan cache (sys.dm_exec_query_stats), with statement text and the Plan Handle for mssql_execution_plan. topN default 25, max 100.

mssql_execution_planA

Execution plan (showplan XML) of a cached query, by plan handle. Reads the plan cache only; never runs the query. Get the Plan Handle from mssql_top_queries. Large plans are cut at 35,000 characters.

mssql_running_requestsA

Running requests now: active user sessions with status, command, CPU, reads, elapsed time, wait type, blocking session, open transactions and the current statement. includeSleeping=true also lists idle sessions that hold an open transaction. For blocked sessions only, use mssql_blocking.

mssql_blockingA

Blocking and locking now: blocked sessions with the blocking session, wait type, wait time and query text. An empty result means no blocking.

mssql_memory_pressureA

Memory pressure: Page Life Expectancy (PLE) from the Buffer Manager. PLE below 300 signals memory pressure; below 1000 on modern servers is worth a look.

mssql_buffer_hit_ratioB

Buffer cache hit ratio (%). Below 95% suggests too little memory for the workload.

mssql_disk_io_latencyA

Disk I/O latency per database file: reads, writes, average read and write stall (ms) and a rating from Exceptional to Critical. Use to find slow storage.

mssql_storage_capacityA

Disk space: drives with less than 10% free space. Any row is a warning. Include in every health check. Not available on Azure SQL Database.

mssql_tempdb_healthA

TempDB health: file layout (count, equal sizes, autogrowth), space use (user objects, internal objects, version store, free space) and the top 10 sessions using tempdb. Flags too few data files, unequal sizes and percent autogrowth.

mssql_server_configA

Server configuration (sp_configure, sys.configurations) with a Flag for risky values: max server memory not capped, cost threshold for parallelism at 5, MAXDOP 0, priority boost, optimize for ad hoc workloads off, xp_cmdshell on, and more. onlyFlagged=true (default) returns only flagged settings.

mssql_error_logA

Error log: read the SQL Server ERRORLOG (or SQL Server Agent log) via sp_readerrorlog. Optionally filter to lines containing one or two search strings (e.g. "Backup", "3013") and select an archived log file. Returns newest entries first. Needs VIEW ANY ERROR LOG (SQL Server 2022+ / Managed Instance) or securityadmin. Not available on Azure SQL Database.

mssql_all_db_infoB

All databases on the instance: state, recovery model, compatibility level, data and log size, read-only, auto close, auto shrink, page verify, create date.

mssql_offline_dbA

Offline databases: databases that are not ONLINE (OFFLINE, RESTORING, RECOVERING, SUSPECT, EMERGENCY). Any row needs attention.

mssql_db_config_healthA

Database settings health for every online user database: compatibility level, recovery model, page verify, auto close, auto shrink, auto statistics, target recovery time and Query Store, with Flags for risky values. onlyFlagged=true (default) returns only flagged databases.

mssql_db_ownersA

Database owners: user databases not owned by sa (SID 0x01, so a renamed sa still counts), including orphaned owners whose login no longer exists. Not available on Azure SQL Database.

mssql_recent_backupsA

Backups: the most recent Full, Differential and Log backup per database in the last 30 days. Databases with no backup show NULL dates. For one database's history use mssql_db_backup_history. Not available on Azure SQL Database.

mssql_checkdb_statusA

CHECKDB and corruption: the last known good DBCC CHECKDB date per online database (flags never, or more than 7 days ago) and the rows in msdb.dbo.suspect_pages (corruption already found). Never runs CHECKDB. Databases the login cannot read show UNKNOWN. Not available on Azure SQL Database.

mssql_vlf_countsA

VLF count: databases whose transaction log has more virtual log files than minVlfCount (default 1000), worst first. Many VLFs slow recovery, restores and log backups. Needs SQL Server 2016 SP2 or later.

mssql_autogrowth_issuesA

Autogrowth issues: data and log files with percent growth, tiny growth (1 MB or less) or autogrowth off, largest files first. Not available on Azure SQL Database.

mssql_agent_jobsA

SQL Agent jobs: every job with its schedule, frequency, interval and last run status. Not available on Azure SQL Database.

mssql_agent_failed_jobsA

SQL Agent failed jobs: jobs that failed in the last 7 days, with date, time and error message. Not available on Azure SQL Database.

mssql_agent_alertsA

SQL Agent alerts: checks alerts for corruption errors 823/824/825 and severities 19-25 and whether an enabled operator gets them, and lists all alerts and operators. Missing corruption alerts become CRITICAL when msdb.dbo.suspect_pages has rows. Not available on Azure SQL Database.

mssql_privileged_loginsA

Security: members of the sysadmin and securityadmin server roles, each marked Expected (in expectedAccounts), Built-in (sa, NT SERVICE*, NT AUTHORITY\SYSTEM, ##...##) or REVIEW. Needs VIEW ANY DEFINITION to see all members. Not available on Azure SQL Database.

mssql_db_infoA

Database info for one database: state, recovery model, compatibility level, data and log size, read-only, auto close, auto shrink, page verify, create date.

mssql_db_collationA

Database collation: the default collation of one database. Use with mssql_db_collation_mismatches for collation conflict errors.

mssql_db_collation_mismatchesA

Collation mismatches: columns (dbo schema) whose collation differs from the database default. A common cause of collation conflict errors in joins with temp tables.

mssql_db_tablesA

Tables overview for one database: every table with row count, size, primary key, index counts (unused, fragmented, missing), index health, read/write workload and access pattern, largest first. Reads index physical stats (LIMITED), which can be slow on very large databases; use mssql_table_info for a few tables.

mssql_db_index_healthA

Index health for one database: every non-PK index with key and included columns, usage (never used, write-only), fragmentation, fill factor advice, size and a suggested DROP, REBUILD or REORGANIZE script to review. Reads index physical stats (LIMITED), which can be slow on very large databases; use mssql_table_index_health for a few tables.

mssql_db_missing_indexesA

Missing indexes for one database, from the missing-index DMVs, ranked by improvement score: urgency, improvement %, uses, equality, inequality and included columns. Only tables with 1000+ rows and real query volume.

mssql_db_backup_historyA

Backup history of one database in the last 7 days: type, start and finish, duration, size, compressed size and file location. Not available on Azure SQL Database.

mssql_db_table_keysA

Table keys: every user table with row count, heap or clustered index, primary key and other unique indexes. Flags heaps, tables without a primary key, and tables where only the primary key is unique. onlyFlagged=true (default) returns only flagged tables.

mssql_db_foreign_keysA

Foreign keys review for one database: each foreign key with trusted, disabled, indexed (unindexed foreign keys slow joins and deletes) and column type or collation mismatches, plus the WITH CHECK CHECK CONSTRAINT fix; and likely missing foreign keys found by column name (for example Votes.PostId -> Posts.Id). Name matching is a guess, so confirm each one.

mssql_db_check_constraintsA

Check constraints that are untrusted or disabled, with the ALTER TABLE ... WITH CHECK CHECK CONSTRAINT fix. The optimizer ignores untrusted constraints, and they may hide invalid rows. For foreign keys use mssql_db_foreign_keys.

mssql_db_identity_headroomA

Identity headroom: identity columns with the % of their type range already used (tinyint to bigint, decimal), most used first. WARN at 50%, RISK at 80%: when an identity runs out, every insert fails.

mssql_db_column_design_issuesB

Column design issues: deprecated types (text, ntext, image), risky types (datetime, float, real, sql_variant) with a suggested type, and tables whose maximum row width is over 6000 bytes (near the 8060-byte row limit).

mssql_table_infoB

Table details for the given tables: row count, size, primary key type, index counts, read/write workload, access pattern and volatility.

mssql_table_index_healthB

Index health for the given tables: fragmentation, usage, fill factor advice and a suggested maintenance script.

mssql_table_missing_indexesB

Missing indexes for the given tables, ranked by improvement score.

mssql_run_selectA

Run one read-only SELECT (or WITH ... SELECT) query: ad-hoc analysis of system views and DMVs when no other tool fits. One statement only; INSERT, UPDATE, EXEC, SET, USE, SELECT INTO and anything else that writes or changes the session are rejected. Use databaseName instead of USE to run in another database. Returns at most 500 rows; add TOP, WHERE or GROUP BY to narrow.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.7/5.0

Scored across 42 tools

Disambiguation4/5

Nearly all 42 tools target distinct diagnostic areas, and descriptions explicitly differentiate scope (e.g., database-wide vs table-specific). However, several scope-variant pairs (mssql_db_tables/mssql_table_info, mssql_db_index_health/mssql_table_index_health, mssql_db_missing_indexes/mssql_table_missing_indexes) could be confused if descriptions are skimmed.

Naming Consistency5/5

All tools use the mssql_ prefix with snake_case and descriptive noun phrases, following a highly predictable domain_topic pattern. No mixing of conventions or vague names.

Tool Count2/5

42 tools is well above the 25+ threshold for 'too many' in this rubric. While each tool addresses a distinct check, many are scope variants that could be consolidated into parameterized tools to reduce agent load.

Completeness4/5

Coverage of core DBA diagnostics—storage, memory, waits, queries, blocking, backups, CHECKDB, VLF, agent, security, database config, and index/table design—is extensive. Minor gaps remain for replication, availability group/mirroring health, and deadlock analysis.