Skip to main content
Glama
lars-hagen

Slack User MCP Server

by lars-hagen

slack_get_channel_history

Retrieve recent messages from a Slack channel using channel ID and optional limit to view conversation history.

Instructions

Get recent messages from a channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYesThe ID of the channel
limitNoNumber of messages to retrieve (default 10)

Implementation Reference

  • Executes the slack_get_channel_history tool by parsing arguments, validating channel_id, calling SlackClient.getChannelHistory, and returning the API response as JSON.
    case "slack_get_channel_history": {
      const args = request.params
        .arguments as unknown as GetChannelHistoryArgs;
      if (!args.channel_id) {
        throw new Error("Missing required argument: channel_id");
      }
      const response = await slackClient.getChannelHistory(
        args.channel_id,
        args.limit,
      );
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Defines the Tool metadata including name, description, and input schema (channel_id required, limit optional) for slack_get_channel_history.
    const getChannelHistoryTool: Tool = {
      name: "slack_get_channel_history",
      description: "Get recent messages from a channel",
      inputSchema: {
        type: "object",
        properties: {
          channel_id: {
            type: "string",
            description: "The ID of the channel",
          },
          limit: {
            type: "number",
            description: "Number of messages to retrieve (default 10)",
            default: 10,
          },
        },
        required: ["channel_id"],
      },
    };
  • SlackClient method that performs the actual API call to Slack's conversations.history endpoint to retrieve channel message history.
    async getChannelHistory(
      channel_id: string,
      limit: number = 10,
    ): Promise<any> {
      const params = new URLSearchParams({
        channel: channel_id,
        limit: limit.toString(),
      });
    
      const response = await fetch(
        `https://slack.com/api/conversations.history?${params}`,
        { headers: this.headers },
      );
    
      return response.json();
    }
  • index.ts:532-546 (registration)
    Registers slack_get_channel_history by including getChannelHistoryTool in the tools list returned for ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.error("Received ListToolsRequest");
      return {
        tools: [
          listChannelsTool,
          postMessageTool,
          replyToThreadTool,
          addReactionTool,
          getChannelHistoryTool,
          getThreadRepliesTool,
          getUsersTool,
          getUserProfileTool,
        ],
      };
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Get recent messages') but doesn't mention critical details like whether this requires specific permissions, rate limits, pagination behavior, or what 'recent' means (e.g., time-based or count-based). This leaves significant gaps for a tool that likely interacts with an external API.

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 a single, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of a Slack API tool with no annotations and no output schema, the description is incomplete. It doesn't address behavioral aspects like authentication needs, error handling, or return format (e.g., message objects with timestamps). For a tool that retrieves data from an external service, more context is needed to ensure proper usage.

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

Parameters3/5

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

The input schema has 100% description coverage, with clear documentation for 'channel_id' and 'limit' (including a default value). The description adds no additional meaning beyond the schema, such as explaining channel ID formats or limit constraints. With high schema coverage, the baseline score of 3 is appropriate.

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 verb ('Get') and resource ('recent messages from a channel'), making the purpose understandable. However, it doesn't distinguish this tool from sibling tools like 'slack_get_thread_replies' or 'slack_list_channels', which also retrieve Slack data, so it misses full differentiation.

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. For example, it doesn't clarify if this is for general channel history versus thread-specific replies (handled by 'slack_get_thread_replies') or user-focused data (handled by 'slack_get_user_profile'). No exclusions or prerequisites are mentioned.

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/lars-hagen/slack-user-mcp'

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