Skip to main content
Version: Next

Slack Read Channel Messages MCP API

The Slack Read Channel Messages MCP API allows you to retrieve message history from Slack channels using the Model Context Protocol interface. For more information about MCP, see the official documentation.

Tool Informationโ€‹

slack_read_channel_messagesโ€‹

  • Tool name: slack_read_channel_messages
  • Function: read_slack_channel_messages
  • Description: Read messages from the given Slack channel. This tool retrieves conversation history for analysis, monitoring, or context gathering.

Input Parametersโ€‹

The tool accepts a SlackReadChannelMessagesInput object with the following parameters:

ParameterTypeRequiredDescription
channelstringYesSlack channel ID (e.g., C12345678) or name with # (e.g., #general)
limitintegerNoMaximum number of messages to return (default: 100, max: 1000)
oldeststringNoStart of time range; Unix timestamp (e.g., 1234567890.123456)
lateststringNoEnd of time range; Unix timestamp (e.g., 1234567890.123456)
inclusivebooleanNoInclude messages with timestamps exactly matching oldest/latest

Usage Examplesโ€‹

Basic Channel Historyโ€‹

{
"channel": "#general",
"limit": 50
}

Channel ID with Time Rangeโ€‹

{
"channel": "C1234567890",
"oldest": "1234567890.123456",
"latest": "1234567891.654321",
"limit": 100,
"inclusive": true
}

Recent Messages Onlyโ€‹

{
"channel": "#notifications",
"limit": 25
}

Messages from Specific Time Periodโ€‹

{
"channel": "C9876543210",
"oldest": "1640995200.000000",
"latest": "1641081600.000000",
"limit": 200
}

Response Formatโ€‹

The tool returns the raw JSON response from Slack's conversations.history API:

{
"ok": true,
"messages": [
{
"type": "message",
"user": "U12345678",
"text": "Hello everyone!",
"ts": "1234567890.123456",
"team": "T1234567890",
"blocks": [...],
"reactions": [
{
"name": "thumbsup",
"users": ["U87654321"],
"count": 1
}
]
},
{
"type": "message",
"user": "U87654321",
"text": "Good morning! How is everyone doing?",
"ts": "1234567889.654321",
"team": "T1234567890"
}
],
"has_more": false,
"pin_count": 0,
"channel_actions_ts": null,
"channel_actions_count": 0
}

Key Response Fieldsโ€‹

FieldDescription
okBoolean indicating if the operation was successful
messagesArray of message objects, ordered from newest to oldest
has_moreBoolean indicating if there are more messages beyond the limit
pin_countNumber of pinned messages in the channel

Message Object Fieldsโ€‹

FieldDescription
typeMessage type (usually "message")
userUser ID of the message sender
textThe message text content
tsMessage timestamp (also serves as unique message ID)
thread_tsIf part of a thread, timestamp of the parent message
reactionsArray of emoji reactions on the message
filesArray of attached files (if any)
blocksRich text blocks (for formatted messages)

Error Handlingโ€‹

This function may raise errors in the following situations:

  • Missing or invalid Slack API token
  • Invalid channel name or ID
  • Insufficient permissions to read the channel
  • Network connectivity issues
  • API rate limiting
  • Invalid timestamp format

Error responses will have "ok": false and include an error message:

{
"ok": false,
"error": "channel_not_found",
"detail": "Value passed for channel was invalid."
}

Common Error Codesโ€‹

Error CodeDescriptionSolution
channel_not_foundChannel doesn't exist or bot lacks accessVerify channel name/ID and bot permissions
not_in_channelBot is not a member of the channelInvite the bot to the channel
invalid_authInvalid or missing API tokenCheck SLACK_BOT_TOKEN environment variable
invalid_ts_oldestInvalid oldest timestamp formatUse proper Unix timestamp format
invalid_ts_latestInvalid latest timestamp formatUse proper Unix timestamp format
rate_limitedToo many requests sentImplement rate limiting in your application

Use Casesโ€‹

Typical scenarios for using slack_read_channel_messages:

  • Conversation Analysis: Analyze discussion patterns and sentiment in team channels
  • Context Gathering: Retrieve recent conversation context before posting responses
  • Message Monitoring: Monitor channel activity for specific keywords or patterns
  • Data Export: Export channel history for compliance or archival purposes
  • Search and Retrieval: Find specific information that was previously shared
  • Bot Training: Collect conversation data for AI model training
  • Activity Reports: Generate summaries of channel activity over time periods

Authenticationโ€‹

This tool requires a valid Slack bot token set in one of the following environment variables:

  • SLACK_BOT_TOKEN (recommended)
  • SLACK_TOKEN (fallback)

The bot must have the following OAuth scopes:

  • channels:history - Required to read public channel history
  • groups:history - Required to read private channel history (if needed)
  • channels:read - Required to access channel information
  • groups:read - Required to access private channel information (if needed)

Rate Limitingโ€‹

Slack enforces rate limits on the conversations.history API:

  • Tier 2: 20+ requests per minute
  • Tier 3: 50+ requests per minute
  • Tier 4: 100+ requests per minute

The server will automatically handle retries according to Slack's rate limiting headers.

Performance Considerationsโ€‹

  • Message Limits: Maximum 1000 messages per request
  • Response Size: Large channels may return significant data; consider using pagination
  • Timestamp Precision: Use precise timestamps (including microseconds) for accurate filtering
  • Memory Usage: Be mindful when processing large message histories in your application

Timestamp Formatโ€‹

Slack timestamps are in Unix format with microseconds:

  • Format: {seconds}.{microseconds}
  • Example: 1234567890.123456
  • You can obtain timestamps from previous API responses or convert from standard date formats