Skip to main content
Glama

test_connection

Verify database connectivity and retrieve basic server details for Microsoft SQL Server connections.

Instructions

Test the database connection and return basic server information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionStringNoSQL Server connection string (uses default if not provided)
connectionNameNoNamed connection to use (e.g., 'production', 'staging')

Implementation Reference

  • The `testConnection` function serves as the core handler for testing a database connection. It executes a simple 'SELECT 1' query using the provided ConnectionPool. If the query fails, it throws a descriptive error. This matches the expected logic for a 'test_connection' tool implementation.
    export async function testConnection(pool: ConnectionPool): Promise<void> { try { await pool.request().query('SELECT 1'); } catch (error) { throw new Error(`Failed to connect to database: ${(error as Error).message}`); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/c0h1b4/mssql-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server