Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions pkg/parser/import_field_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,7 @@ func (acc *importAccumulator) extractEngineConfig(fm map[string]any, fullPath st
// Object engine — extract engine.mcp.* settings first, then decide
// whether to add to engines based on whether an engine ID is present.
if mcpVal, hasMCP := v["mcp"]; hasMCP {
if mcpMap, ok := mcpVal.(map[string]any); ok {
// Extract tool-timeout (first-wins across all imports)
if acc.mergedEngineMCPToolTimeout == "" {
if ttStr, ok := mcpMap["tool-timeout"].(string); ok && ttStr != "" {
acc.mergedEngineMCPToolTimeout = ttStr
parserLog.Printf("Extracted engine.mcp.tool-timeout from import %s: %s", fullPath, ttStr)
}
}
// Extract session-timeout (first-wins across all imports)
if acc.mergedEngineMCPSessionTimeout == "" {
if stStr, ok := mcpMap["session-timeout"].(string); ok && stStr != "" {
acc.mergedEngineMCPSessionTimeout = stStr
parserLog.Printf("Extracted engine.mcp.session-timeout from import %s: %s", fullPath, stStr)
}
}
}
acc.extractEngineMCPSettings(mcpVal, fullPath)
}
// Only add to engines list if this config specifies an actual engine
// (i.e. it carries an 'id' or 'runtime' field). Configs with only
Expand Down Expand Up @@ -367,6 +352,27 @@ func (acc *importAccumulator) extractEngineConfig(fm map[string]any, fullPath st
}
}

// extractEngineMCPSettings extracts engine.mcp.tool-timeout and engine.mcp.session-timeout
// from mcpVal (first-wins across all imports).
func (acc *importAccumulator) extractEngineMCPSettings(mcpVal any, fullPath string) {
mcpMap, ok := mcpVal.(map[string]any)
if !ok {
return
}
if acc.mergedEngineMCPToolTimeout == "" {
if ttStr, ok := mcpMap["tool-timeout"].(string); ok && ttStr != "" {
acc.mergedEngineMCPToolTimeout = ttStr
parserLog.Printf("Extracted engine.mcp.tool-timeout from import %s: %s", fullPath, ttStr)
}
}
if acc.mergedEngineMCPSessionTimeout == "" {
if stStr, ok := mcpMap["session-timeout"].(string); ok && stStr != "" {
acc.mergedEngineMCPSessionTimeout = stStr
parserLog.Printf("Extracted engine.mcp.session-timeout from import %s: %s", fullPath, stStr)
}
}
}

// extractConfigFields extracts scalar and builder-based configuration fields from the
// frontmatter map and writes them into the appropriate accumulator builders and slices.
//
Expand Down
Loading