Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

publish

Send messages to a Redis channel by specifying the target channel and content. Facilitates communication and data distribution within Redis environments.

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 'publish' tool handler: an async function decorated with @mcp.tool() that publishes a message to a Redis channel via RedisConnectionManager, with error handling for RedisError. The docstring provides the tool description, args, and return info used for schema.
    @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)}"
  • Registration of the 'publish' tool using the @mcp.tool() decorator from src.common.server.mcp.
    @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