Skip to main content
Glama

disconnect_redis

Terminate the active connection to a Redis database server to release resources and end the session.

Instructions

断开与 Redis 服务器的连接

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that executes the logic for the 'disconnect_redis' MCP tool. It checks if a Redis connection exists, calls disconnect on the service if so, clears the service references, and returns a standardized MCP response with the result.
    private async handleDisconnectRedis() {
      if (!this.redisService) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ success: false, error: 'Not connected to Redis' }, null, 2)
            }
          ]
        };
      }
      
      const result = await this.redisService.disconnect();
      this.redisService = null;
      this.backupService = null;
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Tool registration in the MCP server's tools list. Defines the tool name, description, and input schema (empty object, no parameters required). This is passed to server.setTools().
    {
      name: 'disconnect_redis',
      description: '断开与 Redis 服务器的连接',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },
  • Dispatch registration in the switch statement of the CallToolRequestHandler. Routes calls to the 'disconnect_redis' tool to its handler method.
    case 'disconnect_redis':
      return await this.handleDisconnectRedis();
  • Input schema for the 'disconnect_redis' tool, defining an empty object (no input parameters required). Part of the tool registration.
    inputSchema: {
      type: 'object',
      properties: {}
    }

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/pickstar-2002/redis-mcp'

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