Skip to main content
Glama

get_channel_history

Retrieve message history from Slack channels by specifying channel ID, time range, and message limits to analyze conversations and track discussions.

Instructions

Get message history from a channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYesChannel ID
limitNoMaximum number of messages to return
oldestNoStart of time range (timestamp)
latestNoEnd of time range (timestamp)

Implementation Reference

  • The handler function implementing the get_channel_history tool logic. It validates input with Zod schema, calls Slack's conversations.history API, and returns formatted messages with pagination info.
    export async function getChannelHistory(client: SlackClientWrapper, args: unknown) {
      const params = getChannelHistorySchema.parse(args);
    
      return await client.safeCall(async () => {
        const result = await client.getClient().conversations.history({
          channel: params.channel,
          limit: params.limit,
          oldest: params.oldest,
          latest: params.latest,
          cursor: params.cursor,
        });
    
        return {
          messages: result.messages || [],
          has_more: result.has_more,
          next_cursor: result.response_metadata?.next_cursor,
        };
      });
    }
  • Zod schema defining and validating the input parameters for the get_channel_history tool, including channel ID, optional limit, time ranges, and cursor.
    export const getChannelHistorySchema = z.object({
      channel: channelIdSchema,
      limit: z.number().min(1).max(1000).optional().default(100),
      oldest: timestampSchema.optional(),
      latest: timestampSchema.optional(),
      cursor: z.string().optional(),
    });
  • src/index.ts:236-263 (registration)
    Registration of the get_channel_history tool in the list_tools response, providing name, description, and JSON input schema.
      name: 'get_channel_history',
      description: 'Get message history from a channel',
      inputSchema: {
        type: 'object',
        properties: {
          channel: {
            type: 'string',
            description: 'Channel ID',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of messages to return',
            default: 100,
            minimum: 1,
            maximum: 1000,
          },
          oldest: {
            type: 'string',
            description: 'Start of time range (timestamp)',
          },
          latest: {
            type: 'string',
            description: 'End of time range (timestamp)',
          },
        },
        required: ['channel'],
      },
    },
  • src/index.ts:429-429 (registration)
    Binding of the get_channel_history tool name to its handler function in the toolHandlers map for call_tool requests.
    get_channel_history: (args) => messageTools.getChannelHistory(slackClient, args),
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 but doesn't mention permissions, rate limits, pagination, or what the output looks like (e.g., message format, ordering). For a read operation with 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 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 retrieving message history, lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like ordering, permissions, or output format, which are crucial for an agent to use the tool effectively in context.

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 description coverage is 100%, with clear parameter descriptions in the input schema. The description adds no additional meaning beyond implying message retrieval, so it meets the baseline of 3 where the schema does the heavy lifting without extra value from the description.

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 ('message history from a channel'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'search_messages' or 'get_channel_info', which might also retrieve message-related 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 such as 'search_messages' or 'list_channels'. It lacks context about scenarios like retrieving historical messages versus searching or filtering, leaving the agent to infer usage from the name alone.

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/Hais/slack-bot-mcp'

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