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

Function getDynamicSuggestedPrompts

server/src/addie/handler.ts:476–493  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

474}
475
476async function getDynamicSuggestedPrompts(userId: string): Promise<SuggestedPrompt[]> {
477 try {
478 const memberContext = await getMemberContext(userId);
479 const userIsAdmin = await isSlackUserAAOAdmin(userId);
480 const { prompts, ruleIds } = pickPrompts(memberContext, userIsAdmin);
481 const workosUserId = memberContext?.workos_user?.workos_user_id;
482 if (workosUserId && ruleIds.length > 0) {
483 void recordPromptsShown(workosUserId, ruleIds);
484 }
485 return prompts.map((p) => ({
486 title: p.label,
487 message: p.prompt,
488 }));
489 } catch (error) {
490 logger.warn({ error, userId }, 'Addie: Failed to build dynamic prompts, using defaults');
491 return SUGGESTED_PROMPTS;
492 }
493}
494
495/**
496 * Handle Assistant thread started event

Callers 1

Calls 5

getMemberContextFunction · 0.85
isSlackUserAAOAdminFunction · 0.85
pickPromptsFunction · 0.85
recordPromptsShownFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected