MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / getChannelInfo

Function getChannelInfo

server/src/slack/client.ts:673–707  ·  view source on GitHub ↗
(channelId: string)

Source from the content-addressed store, hash-verified

671 * Get channel info by ID (cached for 30 minutes)
672 */
673export async function getChannelInfo(channelId: string): Promise<SlackChannel | null> {
674 const now = Date.now();
675
676 // Check cache
677 const cached = channelCache.get(channelId);
678 if (cached && cached.expiresAt > now) {
679 return cached.channel;
680 }
681
682 try {
683 const response = await slackRequest<{ channel: SlackChannel }>('conversations.info', {
684 channel: channelId,
685 });
686
687 // Evict oldest entry if cache is full
688 if (channelCache.size >= MAX_CHANNEL_CACHE_SIZE) {
689 const oldestKey = channelCache.keys().next().value;
690 if (oldestKey) {
691 channelCache.delete(oldestKey);
692 }
693 }
694
695 // Cache the result
696 channelCache.set(channelId, {
697 channel: response.channel,
698 expiresAt: now + CHANNEL_CACHE_TTL_MS,
699 });
700
701 return response.channel;
702 } catch (error) {
703 const safeId = channelId.replace(/[^A-Za-z0-9]/g, '');
704 logger.warn({ error, channelId }, `Failed to get channel info for ${safeId}`);
705 return null;
706 }
707}
708
709/**
710 * Get members of a channel

Callers 7

buildChannelContextFunction · 0.85
indexChannelMessageFunction · 0.85
runSlackHistoryBackfillFunction · 0.85
checkChannelAccessFunction · 0.85
indexMessageForSearchFunction · 0.85

Calls 6

nowMethod · 0.80
nextMethod · 0.80
deleteMethod · 0.80
warnMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected