Skip to main content
Glama

test_connection

Validate Valkey/Redis connection credentials before adding them to BetterDB MCP. Test connectivity without persisting data to ensure proper configuration.

Instructions

Test a Valkey/Redis connection without persisting it. Use before add_connection to validate credentials.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesDisplay name for the connection
hostYesHostname or IP address
portNoPort number
usernameNoACL username (default: "default")
passwordNoAuth password

Implementation Reference

  • The implementation of the 'test_connection' MCP tool, which calls the backend '/connections/test' endpoint to validate connection parameters.
    server.tool(
      'test_connection',
      'Test a Valkey/Redis connection without persisting it. Use before add_connection to validate credentials.',
      {
        name: z.string().describe('Display name for the connection'),
        host: z.string().describe('Hostname or IP address'),
        port: z.number().int().min(1).max(65535).default(6379).describe('Port number'),
        username: z.string().optional().describe('ACL username (default: "default")'),
        password: z.string().optional().describe('Auth password'),
      },
      async (params) => {
        try {
          const data = await apiRequest('POST', '/connections/test', params) as {
            success: boolean;
            capabilities?: unknown;
            error?: string;
          };
          if (isLicenseError(data)) {
            return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] };
          }
          if (!data.success) {
            return {
              content: [{ type: 'text' as const, text: data.error ?? 'Connection test failed' }],
              isError: true,
            };
          }
          return {
            content: [{ type: 'text' as const, text: data.capabilities ? JSON.stringify(data.capabilities, null, 2) : 'Connection successful' }],
          };
        } catch (err) {
          return {
            content: [{ type: 'text' as const, text: err instanceof Error ? err.message : String(err) }],
            isError: true,
          };
        }
      },
    );

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/BetterDB-inc/monitor'

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