MCP Integration Tests: Agent file parsing errors in AgentLoader
Author: coderabbitai[bot]Created Sep 5, 2025Updated Sep 16, 2026
Problem
The MCP integration tests reference "Error parsing agent file" failures, likely related to the AgentLoader component attempting to parse agent definition files from .claude/agents/.
Error Details
- Error type: "Error parsing agent file"
- Component:
src/agents/agent-loader.ts - Related files: Agent markdown files in
.claude/agents/directory
Root Cause Analysis
The AgentLoader attempts to parse agent definition files from markdown with YAML frontmatter. Potential issues:
- Missing or malformed YAML frontmatter in agent files
- Missing required fields (name, metadata.description)
- Invalid YAML syntax in frontmatter sections
- File access permissions or missing files
Impact
- Agent definitions may not load properly
- MCP tools that depend on agent spawning may fail
- System initialization may be affected
Investigation Findings
.claude/agents/directory exists with multiple agent files- AgentLoader expects specific frontmatter format:
--- name: agent-name metadata: description: "Agent description" ---
Reproduction Steps
- Run agent loader in test environment
- Observe parsing errors for specific agent files
- Check console output for detailed error messages
Suggested Fix
- Validate agent file formats - Ensure all .md files have proper YAML frontmatter
- Add better error handling - More specific error messages for different failure types
- Add file validation - Pre-validate agent files during initialization
- Improve logging - Include file paths in error messages for easier debugging
Related Files
src/agents/agent-loader.ts(main parsing logic).claude/agents/**/*.md(agent definition files)tests/integration/mcp.test.ts(affected test)
Backlinks:
Source: ruvnet/ruflo