MCPcopy
hub / github.com/claude-code-best/claude-code / processAgentMentions

Function processAgentMentions

src/utils/attachments.ts:2018–2045  ·  view source on GitHub ↗
(
  input: string,
  agents: AgentDefinition[],
)

Source from the content-addressed store, hash-verified

2016}
2017
2018function processAgentMentions(
2019 input: string,
2020 agents: AgentDefinition[],
2021): Attachment[] {
2022 const agentMentions = extractAgentMentions(input)
2023 if (agentMentions.length === 0) return []
2024
2025 const results = agentMentions.map(mention => {
2026 const agentType = mention.replace('agent-', '')
2027 const agentDef = agents.find(def => def.agentType === agentType)
2028
2029 if (!agentDef) {
2030 logEvent('tengu_at_mention_agent_not_found', {})
2031 return null
2032 }
2033
2034 logEvent('tengu_at_mention_agent_success', {})
2035
2036 return {
2037 type: 'agent_mention' as const,
2038 agentType: agentDef.agentType,
2039 }
2040 })
2041
2042 return results.filter(
2043 (result): result is NonNullable<typeof result> => result !== null,
2044 )
2045}
2046
2047async function processMcpResourceAttachments(
2048 input: string,

Callers 1

getAttachmentsFunction · 0.85

Calls 2

extractAgentMentionsFunction · 0.85
logEventFunction · 0.85

Tested by

no test coverage detected