Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/A-Point-Systems-ltd/ms-sql-mcp/llms.txt

Use this file to discover all available pages before exploring further.

GetServerInfo returns a three-section snapshot of the connected SQL Server or Azure SQL Database instance: server property values (version, edition, server and machine names, collation, and more), hardware and process runtime metrics, and user-database counts. It is compatible with SQL Server 2008 R2 through SQL Server 2022 and Azure SQL Database. GetServerInfo takes no parameters and is a useful first call to verify that the MCP server connection is active and to identify the SQL Server version and edition before issuing other tool calls.

Parameters

This tool takes no parameters.

Returns

server
object
SQL Server instance properties from SERVERPROPERTY() and @@VERSION.
hardware
object
Runtime hardware and process memory metrics. Individual fields are null when the account lacks VIEW SERVER STATE or when a DMV column does not exist on the target SQL Server version. The call always succeeds even when all hardware fields are null.
databases
object
Count of user databases (excludes the four system databases: master, tempdb, model, msdb).

Graceful degradation

GetServerInfo issues hardware queries against sys.dm_os_sys_info and sys.dm_os_process_memory inside separate try/catch blocks. If either query fails — because the account lacks VIEW SERVER STATE, or because a column was removed or renamed in the target SQL Server version — the server logs a warning, populates the hardware.warning field with the error message, and continues. The response is always returned successfully as long as the server-properties query succeeds.
VIEW SERVER STATE is typically required to read DMVs. On Azure SQL Database and Azure SQL Managed Instance, VIEW DATABASE STATE is often sufficient for subset DMV access, but hardware-level DMVs may still be restricted. Check hardware.warning to confirm.

Usage notes

Call GetServerInfo as the first tool when starting a new investigation session. It verifies connectivity and gives you the SQL Server version and edition, which determines which features and syntax are available (e.g. TRY_CAST is not available before SQL Server 2012, and some DMV columns vary between versions).
databases.totalDatabases counts user databases only. To enumerate the databases by name use ReadData with SELECT name, state_desc FROM sys.databases WHERE database_id > 4.

Example

Request

{
  "tool": "GetServerInfo",
  "arguments": {}
}

Response — full access

{
  "success": true,
  "data": {
    "server": {
      "productVersion": "16.0.1000.6",
      "productLevel": "RTM",
      "edition": "Developer Edition (64-bit)",
      "engineEdition": 3,
      "serverName": "DEVBOX\\SQLEXPRESS",
      "machineName": "DEVBOX",
      "instanceName": "SQLEXPRESS",
      "isClustered": 0,
      "isFullTextInstalled": 1,
      "isIntegratedSecurityOnly": 0,
      "collation": "SQL_Latin1_General_CP1_CI_AS",
      "versionString": "Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64) ...(Developer Edition)"
    },
    "hardware": {
      "cpuCount": 8,
      "hyperthreadRatio": 8,
      "physicalMemoryMB": 1024,
      "virtualMemoryMB": 2048,
      "sqlServerStartTime": "2024-06-20T07:15:00",
      "warning": null
    },
    "databases": {
      "totalDatabases": 3,
      "onlineDatabases": 3,
      "offlineDatabases": 0
    }
  }
}

Response — restricted account (hardware unavailable)

{
  "success": true,
  "data": {
    "server": {
      "productVersion": "12.0.6439.10",
      "productLevel": "SP3",
      "edition": "Standard Edition (64-bit)",
      "engineEdition": 2,
      "serverName": "PRODSERVER",
      "machineName": "PRODSERVER",
      "instanceName": null,
      "isClustered": 0,
      "isFullTextInstalled": 0,
      "isIntegratedSecurityOnly": 0,
      "collation": "SQL_Latin1_General_CP1_CI_AS",
      "versionString": "Microsoft SQL Server 2014 (SP3) - 12.0.6439.10 (X64) ..."
    },
    "hardware": {
      "cpuCount": null,
      "hyperthreadRatio": null,
      "physicalMemoryMB": null,
      "virtualMemoryMB": null,
      "sqlServerStartTime": null,
      "warning": "sys.dm_os_sys_info unavailable: The user does not have permission to perform this action."
    },
    "databases": {
      "totalDatabases": 5,
      "onlineDatabases": 4,
      "offlineDatabases": 1
    }
  }
}

Build docs developers (and LLMs) love