Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

get_channel_history

Retrieve message history from a Slack channel by specifying channel ID, time range, and message limit to access past conversations.

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
limitNo
oldestNo
latestNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main MCP tool handler function for 'get_channel_history'. It instantiates SlackClient and delegates to its get_channel_history method, serializing the result to JSON.
    @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)
  • Helper method in SlackClient class that makes the actual Slack API call to conversations.history endpoint.
    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)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves message history but doesn't cover critical aspects like authentication requirements, rate limits, pagination behavior, error handling, or whether it's read-only (implied by 'Get' but not explicit). For a tool with 4 parameters and no annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and well-structured. It starts with a clear purpose statement, followed by a bullet-point list of parameters with brief explanations. Every sentence earns its place, with no redundant or verbose language, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, no annotations, but with an output schema), the description is partially complete. It covers the purpose and parameters well, but lacks behavioral context (e.g., auth, limits) and usage guidelines. The presence of an output schema means return values don't need explanation, but other gaps keep this from being fully adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds substantial value beyond the input schema, which has 0% schema description coverage. It explains each parameter's purpose: 'channel: Channel ID,' 'limit: Maximum number of messages to return,' 'oldest: Only messages after this timestamp,' and 'latest: Only messages before this timestamp.' This clarifies semantics that the schema alone doesn't provide, compensating well for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get message history for a Slack channel.' It specifies the verb ('Get') and resource ('message history for a Slack channel'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'search_messages' or 'get_channel_info,' which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'search_messages' (which might offer more flexible filtering) or 'get_channel_info' (which provides metadata rather than messages), leaving the agent without context for tool selection. This lack of comparative information results in a low score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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