From 19194a53f318d34864fd9db0916dbd45bcb3b55f Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 17 Feb 2026 21:27:32 -0800 Subject: [PATCH] fix --- .../LogDetailsDrawer/LogDetailContent.tsx | 36 +++++++++++-------- .../LogDetailsDrawer/LogDetailsDrawer.tsx | 16 +++++++++ 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx index 1dfcf97134a..60631f6861b 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx @@ -42,6 +42,10 @@ export interface LogDetailContentProps { /** When true, log details (messages/response) are still being lazy-loaded. */ isLoadingDetails?: boolean; accessToken?: string | null; + /** Guardrail info inherited from the parent LLM call (used for MCP call_mcp_tool views). */ + parentGuardrailInfo?: any; + /** Log entry of the parent LLM call, used to build the compliance panel context for MCP calls. */ + parentLogEntry?: LogEntry | null; } /** @@ -52,7 +56,7 @@ export interface LogDetailContentProps { * Designed to be placed inside LogDetailsDrawer's right panel so it can * be reused for both single-log and session-mode views. */ -export function LogDetailContent({ logEntry, onOpenSettings, isLoadingDetails = false, accessToken }: LogDetailContentProps) { +export function LogDetailContent({ logEntry, onOpenSettings, isLoadingDetails = false, accessToken, parentGuardrailInfo, parentLogEntry }: LogDetailContentProps) { const metadata = logEntry.metadata || {}; const hasError = metadata.status === "failure"; const errorInfo = hasError ? metadata.error_information : null; @@ -62,12 +66,14 @@ export function LogDetailContent({ logEntry, onOpenSettings, isLoadingDetails = // Don't show "missing data" warning while details are still loading const missingData = !hasMessages && !hasResponse && !hasError && !isLoadingDetails; - // Guardrail data - const guardrailInfo = metadata?.guardrail_information; + // Guardrail data — fall back to parent LLM call's guardrail info for MCP calls + const isMcpCall = logEntry.call_type === "call_mcp_tool" || logEntry.call_type === "list_mcp_tools"; + const guardrailInfo = metadata?.guardrail_information || (isMcpCall ? parentGuardrailInfo : undefined); const guardrailEntries = normalizeGuardrailEntries(guardrailInfo); const hasGuardrailData = guardrailEntries.length > 0; const totalMaskedEntities = calculateTotalMaskedEntities(guardrailEntries); const primaryGuardrailLabel = getGuardrailLabel(guardrailEntries); + const complianceLogEntry = isMcpCall && parentLogEntry ? parentLogEntry : logEntry; // Vector store data const hasVectorStoreData = checkHasVectorStoreData(metadata); @@ -165,32 +171,32 @@ export function LogDetailContent({ logEntry, onOpenSettings, isLoadingDetails = /> )} - {/* Compliance Panel – always visible */} + {/* Compliance Panel – always visible (uses parent LLM call data for MCP calls) */}
- {/* Guardrail Data */} + {/* Guardrail Data (inherits from parent LLM call for MCP calls) */} {hasGuardrailData && (
diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx index 6f85c81ce1c..e16ee93e02c 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx @@ -235,6 +235,20 @@ export function LogDetailsDrawer({ } catch { /* clipboard unavailable in non-secure contexts */ } }; + // For MCP calls, find the parent LLM call's guardrail info from the session + const parentLlmLog = useMemo(() => { + if (!currentLog) return null; + const isMcp = MCP_CALL_TYPES.includes(currentLog.call_type); + if (!isMcp) return null; + + const logsToSearch = isSessionMode ? sessionLogs : allLogs; + return logsToSearch.find( + (row) => + !MCP_CALL_TYPES.includes(row.call_type) && + row.metadata?.guardrail_information + ) ?? null; + }, [currentLog, isSessionMode, sessionLogs, allLogs]); + if (!currentLog || !enrichedLog) return null; return ( @@ -385,6 +399,8 @@ export function LogDetailsDrawer({ onOpenSettings={onOpenSettings} isLoadingDetails={isLoadingDetails} accessToken={accessToken ?? null} + parentGuardrailInfo={parentLlmLog?.metadata?.guardrail_information} + parentLogEntry={parentLlmLog} />