Skip to main content
Glama

get_recent_slack_messages

Retrieve recent messages from a Slack channel to monitor conversations, track updates, and stay informed about team discussions.

Instructions

Fetch recent messages from a Slack channel.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
limitNo

Implementation Reference

  • main.py:158-181 (handler)
    The handler function for the get_recent_slack_messages tool. It fetches the recent messages from the specified Slack channel using the Slack conversations.history API, retrieves a user name mapping, formats each message with timestamp, user name, and text, and returns them separated by ---.
    @mcp.tool() async def get_recent_slack_messages(channel_id: str, limit: int = 5) -> str: """Fetch recent messages from a Slack channel.""" params = { "channel": channel_id, "limit": limit } data = await make_slack_request("conversations.history", params) if not data or not data.get("ok"): return "Unable to fetch Slack messages." messages = data.get("messages", []) if not messages: return "No messages found in the channel." # 🔁 Get user ID to name map user_map = await get_user_name_map() # Format with name formatted = [ format_slack_message(msg, user_map) for msg in messages ] return "\n---\n".join(formatted)

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/Abu-BakarYasir/my_slack_mcp'

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