MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parseAgentsFromJson

Function parseAgentsFromJson

src/tools/AgentTool/loadAgentsDir.ts:521–536  ·  view source on GitHub ↗
(
  agentsJson: unknown,
  source: SettingSource = 'flagSettings',
)

Source from the content-addressed store, hash-verified

519 * Parses multiple agents from a JSON object
520 */
521export function parseAgentsFromJson(
522 agentsJson: unknown,
523 source: SettingSource = 'flagSettings',
524): AgentDefinition[] {
525 try {
526 const parsed = AgentsJsonSchema().parse(agentsJson)
527 return Object.entries(parsed)
528 .map(([name, def]) => parseAgentFromJson(name, def, source))
529 .filter((agent): agent is CustomAgentDefinition => agent !== null)
530 } catch (error) {
531 const errorMessage = error instanceof Error ? error.message : String(error)
532 logForDebugging(`Error parsing agents from JSON: ${errorMessage}`)
533 logError(error)
534 return []
535 }
536}
537
538/**
539 * Parses agent definition from markdown file data

Callers 2

runFunction · 0.85
handleInitializeRequestFunction · 0.85

Calls 5

parseAgentFromJsonFunction · 0.85
logForDebuggingFunction · 0.85
entriesMethod · 0.80
logErrorFunction · 0.50
parseMethod · 0.45

Tested by

no test coverage detected