MCPcopy
hub / github.com/codeaashu/claude-code / generateAgentSuggestions

Function generateAgentSuggestions

src/hooks/unifiedSuggestions.ts:77–109  ·  view source on GitHub ↗
(
  agents: AgentDefinition[],
  query: string,
  showOnEmpty = false,
)

Source from the content-addressed store, hash-verified

75}
76
77function generateAgentSuggestions(
78 agents: AgentDefinition[],
79 query: string,
80 showOnEmpty = false,
81): AgentSuggestionSource[] {
82 if (!query && !showOnEmpty) {
83 return []
84 }
85
86 try {
87 const agentSources: AgentSuggestionSource[] = agents.map(agent => ({
88 type: 'agent' as const,
89 displayText: `${agent.agentType} (agent)`,
90 description: truncateDescription(agent.whenToUse),
91 agentType: agent.agentType,
92 color: getAgentColor(agent.agentType),
93 }))
94
95 if (!query) {
96 return agentSources
97 }
98
99 const queryLower = query.toLowerCase()
100 return agentSources.filter(
101 agent =>
102 agent.agentType.toLowerCase().includes(queryLower) ||
103 agent.displayText.toLowerCase().includes(queryLower),
104 )
105 } catch (error) {
106 logError(error as Error)
107 return []
108 }
109}
110
111export async function generateUnifiedSuggestions(
112 query: string,

Callers 1

Calls 3

truncateDescriptionFunction · 0.85
getAgentColorFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected