Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

get_channel_history

Retrieve message history from a Slack channel by specifying the channel ID, message limit, and timestamps for filtering. Manage conversations and analyze data effectively.

Instructions

Get message history for a Slack channel.

Args: channel: Channel ID limit: Maximum number of messages to return oldest: Only messages after this timestamp latest: Only messages before this timestamp

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
latestNo
limitNo
oldestNo

Implementation Reference

  • MCP tool handler for get_channel_history. Creates SlackClient instance, calls the client's get_channel_history method, and returns JSON string of the result or error.
    @mcp.tool() async def get_channel_history( channel: str, limit: int = 100, oldest: Optional[str] = None, latest: Optional[str] = None ) -> str: """ Get message history for a Slack channel. Args: channel: Channel ID limit: Maximum number of messages to return oldest: Only messages after this timestamp latest: Only messages before this timestamp """ try: client = SlackClient() result = await client.get_channel_history(channel, limit, oldest, latest) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
  • SlackClient helper method that makes the actual API request to Slack's conversations.history endpoint with the provided parameters.
    async def get_channel_history( self, channel: str, limit: int = 100, oldest: Optional[str] = None, latest: Optional[str] = None, inclusive: bool = True, ) -> Dict[str, Any]: """Get message history for a channel.""" params = {"channel": channel, "limit": limit, "inclusive": inclusive} if oldest: params["oldest"] = oldest if latest: params["latest"] = latest return await self._make_request("GET", "conversations.history", params=params)

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/piekstra/slack-mcp-server'

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