fix(generator): Handle mcp_tool objects in command transformer - #29
Conversation
The command-transformer.js was treating step.mcp_tool as an implicit field that was ignored during markdown generation. However, the YAML allows mcp_tool objects with properties like name, usage, and fallback. When the generator encountered these objects, they were not rendered at all in the generated markdown, losing important MCP tool configuration information. Changes: - Handle mcp_tool as an object with name, usage, and fallback properties - Maintain backward compatibility with string-only mcp_tool values - Format usage as multi-line content, fallback as inline description - Similar pattern to delegation object handling Affected commands: - create-trd (3 MCP tool steps now properly documented) This follows the same pattern as PR #28 which fixed object rendering in the agent-transformer.js for qualityStandards sections.
Code Review for PR #29SummaryThis PR fixes a bug where ✅ Strengths1. Consistent ArchitectureThe implementation follows the exact same pattern as PR #28's fix for
2. Backward CompatibilityThe code properly handles both formats: // Object format (new)
mcp_tool: { name: 'tool_name', usage: '...', fallback: '...' }
// String format (legacy)
mcp_tool: 'tool_name'3. Proper Null SafetyUses safe property access and type checking before rendering: if (step.mcp_tool) {
if (typeof step.mcp_tool === 'object') {
if (step.mcp_tool.name) { ... }
}
}4. Clean Markdown OutputThe generated markdown is well-formatted with proper indentation and spacing, making MCP tool documentation clear and readable. 5. Documentation CleanupRemoves outdated "AgentOS" reference in fold-prompt files, keeping documentation current. 🔍 Observations & Suggestions1. Formatting Issue: List Indentation
|
Version bump for generator fixes. Changes included: - fix(generator): Handle object types in qualityStandards section (PR #28) - fix(generator): Handle mcp_tool objects in command transformer (PR #29) Affected packages: - ensemble-plugins: 5.0.0 -> 5.2.3 - @fortium/ensemble-core: 5.2.1 -> 5.2.3 - @fortium/ensemble-development: 5.2.1 -> 5.2.3 - @fortium/ensemble-quality: 5.2.1 -> 5.2.3 - @fortium/ensemble-infrastructure: 5.2.1 -> 5.2.3 - @fortium/ensemble-product: 5.2.1 -> 5.2.3 - @fortium/ensemble-full: 5.2.2 -> 5.2.3
fix(generator): Handle mcp_tool objects in command transformer
Version bump for generator fixes. Changes included: - fix(generator): Handle object types in qualityStandards section (PR #28) - fix(generator): Handle mcp_tool objects in command transformer (PR #29) Affected packages: - ensemble-plugins: 5.0.0 -> 5.2.3 - @fortium/ensemble-core: 5.2.1 -> 5.2.3 - @fortium/ensemble-development: 5.2.1 -> 5.2.3 - @fortium/ensemble-quality: 5.2.1 -> 5.2.3 - @fortium/ensemble-infrastructure: 5.2.1 -> 5.2.3 - @fortium/ensemble-product: 5.2.1 -> 5.2.3 - @fortium/ensemble-full: 5.2.2 -> 5.2.3
Summary
Fixed a bug where the
mcp_toolfield in command YAML files was being ignored during markdown generation, similar to the qualityStandards issue fixed in PR #28.What was broken
The
command-transformer.jswas not handlingstep.mcp_toolobjects at all. The create-trd command has 3 steps withmcp_toolobjects containing:name- MCP tool nameusage- Multi-line usage documentationfallback- Fallback behavior descriptionBefore (broken):
The MCP tool details (usage, fallback) were completely missing.
Why it was broken
The command-transformer.js only handled:
But it ignored the
mcp_toolobject entirely, even though it's defined in the YAML.How it was fixed
Added mcp_tool handling after the delegation section:
mcp_toolis an object or stringname,usage, andfallbackpropertiesAfter (fixed):
Affected commands
Testing
npm run generatecompletes successfullyRelated
This follows the same pattern as PR #28 which fixed object rendering in agent-transformer.js for qualityStandards sections.