MCPcopy Create free account
hub / github.com/Noumena-Network/code / processAgentMentions

Function processAgentMentions

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

Source from the content-addressed store, hash-verified

1970}
1971
1972function processAgentMentions(
1973 input: string,
1974 agents: AgentDefinition[],
1975): Attachment[] {
1976 const agentMentions = extractAgentMentions(input)
1977 if (agentMentions.length === 0) return []
1978
1979 const results = agentMentions.map(mention => {
1980 const agentType = mention.replace('agent-', '')
1981 const agentDef = agents.find(def => def.agentType === agentType)
1982
1983 if (!agentDef) {
1984 logEvent('ncode_at_mention_agent_not_found', {})
1985 return null
1986 }
1987
1988 logEvent('ncode_at_mention_agent_success', {})
1989
1990 return {
1991 type: 'agent_mention' as const,
1992 agentType: agentDef.agentType,
1993 }
1994 })
1995
1996 return results.filter(
1997 (result): result is NonNullable<typeof result> => result !== null,
1998 )
1999}
2000
2001async function processMcpResourceAttachments(
2002 input: string,

Callers 1

getAttachmentsFunction · 0.85

Calls 2

extractAgentMentionsFunction · 0.85
logEventFunction · 0.50

Tested by

no test coverage detected