Skip to main content
Glama
Stig-Johnny

Slack Notifications MCP Server

by Stig-Johnny

get_channel_messages

Retrieve recent messages from a Slack channel using its ID, with an optional limit up to 100 messages.

Instructions

Read recent messages from a specific Slack channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idNoSlack channel ID (e.g., C01234567). If not provided, uses the build channel.
limitNoNumber of messages to retrieve (default: 10, max: 100)

Implementation Reference

  • index.js:68-86 (registration)
    Tool registration for 'get_channel_messages' in the ListToolsRequestSchema handler. Defines name, description, and inputSchema (channel_id and limit parameters).
    {
      name: "get_channel_messages",
      description: "Read recent messages from a specific Slack channel",
      inputSchema: {
        type: "object",
        properties: {
          channel_id: {
            type: "string",
            description: "Slack channel ID (e.g., C01234567). If not provided, uses the build channel.",
          },
          limit: {
            type: "number",
            description: "Number of messages to retrieve (default: 10, max: 100)",
            default: 10,
          },
        },
        required: [],
      },
    },
  • Input schema for get_channel_messages: channel_id (string, optional, defaults to build channel) and limit (number, optional, default 10, max 100).
      inputSchema: {
        type: "object",
        properties: {
          channel_id: {
            type: "string",
            description: "Slack channel ID (e.g., C01234567). If not provided, uses the build channel.",
          },
          limit: {
            type: "number",
            description: "Number of messages to retrieve (default: 10, max: 100)",
            default: 10,
          },
        },
        required: [],
      },
    },
  • Handler for 'get_channel_messages' tool. Uses slack.conversations.history() to fetch messages from the specified channel (or build channel if not provided). Returns messages with timestamp, user, text, and bot_id fields.
    case "get_channel_messages": {
      const channelId = args?.channel_id || buildChannelId;
      if (!channelId) {
        return {
          content: [
            {
              type: "text",
              text: "Error: No channel_id provided and SLACK_BUILD_CHANNEL_ID not configured.",
            },
          ],
        };
      }
    
      const limit = Math.min(args?.limit || 10, 100);
      const result = await slack.conversations.history({
        channel: channelId,
        limit: limit,
      });
    
      const messages = (result.messages || []).map((msg) => ({
        timestamp: new Date(parseFloat(msg.ts) * 1000).toISOString(),
        user: msg.user,
        text: msg.text?.substring(0, 500),
        bot_id: msg.bot_id,
      }));
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({ messages }, null, 2),
          },
        ],
      };
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states 'Read recent messages', omitting behavioral traits like rate limits, pagination, or response structure. The read-only nature is implied but not explicit.

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 sentence of 6 words, directly stating the core purpose with no wasted text. It is optimally concise and front-loaded.

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?

The tool is simple with two parameters and no output schema. The description covers the basic intent but does not hint at return format or explain 'recent' (e.g., time window). It is minimally adequate.

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?

Schema coverage is 100%, so the schema already documents both parameters effectively. The description adds no additional semantic context beyond the schema's descriptions.

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

Purpose5/5

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

The description clearly specifies the action (Read) and resource (recent messages from a specific Slack channel), distinguishing it from sibling tools like search_messages (search) and send_message (send). It is unambiguous and actionable.

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?

No guidance on when to use this tool versus alternatives (e.g., search_messages for historical queries). No mention of prerequisites or context of use.

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/Stig-Johnny/slack-notifications-mcp'

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