Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

publish

Send messages to Redis channels for real-time communication and data distribution in applications.

Instructions

Publish a message to a Redis channel.

Args: channel: The Redis channel to publish to. message: The message to send.

Returns: A success message or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
messageYes

Implementation Reference

  • The core handler function for the 'publish' MCP tool. It is decorated with @mcp.tool() which registers it as an MCP tool. The function publishes a message to a specified Redis channel and returns a success or error message.
    @mcp.tool() async def publish(channel: str, message: str) -> str: """Publish a message to a Redis channel. Args: channel: The Redis channel to publish to. message: The message to send. Returns: A success message or an error message. """ try: r = RedisConnectionManager.get_connection() r.publish(channel, message) return f"Message published to channel '{channel}'." except RedisError as e: return f"Error publishing message to channel '{channel}': {str(e)}"
  • The @mcp.tool() decorator registers the publish function as an MCP tool.
    @mcp.tool()

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