Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

unsubscribe

Stop receiving messages from a specific Redis channel using this tool. Input the channel name to unsubscribe and receive a confirmation or error response.

Instructions

Unsubscribe from a Redis channel.

Args: channel: The Redis channel to unsubscribe from.

Returns: A success message or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes

Implementation Reference

  • The main handler function for the 'unsubscribe' tool. It uses Redis pubsub to unsubscribe from the given channel and returns a confirmation message or error.
    @mcp.tool() async def unsubscribe(channel: str) -> str: """Unsubscribe from a Redis channel. Args: channel: The Redis channel to unsubscribe from. Returns: A success message or an error message. """ try: r = RedisConnectionManager.get_connection() pubsub = r.pubsub() pubsub.unsubscribe(channel) return f"Unsubscribed from channel '{channel}'." except RedisError as e: return f"Error unsubscribing from channel '{channel}': {str(e)}"
  • The @mcp.tool() decorator registers the unsubscribe function as an MCP tool.
    @mcp.tool()
  • Input schema defined by function parameter 'channel: str' and output 'str'. Docstring provides additional description.
    @mcp.tool() async def unsubscribe(channel: str) -> str: """Unsubscribe from a Redis channel. Args: channel: The Redis channel to unsubscribe from. Returns: A success message or an 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/redis/mcp-redis'

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