From b30eab7935480469e3afb9ac73afba03789efd55 Mon Sep 17 00:00:00 2001 From: Chandrapal Badshah Date: Tue, 5 Aug 2025 13:02:35 +0530 Subject: [PATCH] fix: Don't invoke tools if no providers or completed scans (#8443) Co-authored-by: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com> --- ui/lib/lighthouse/data.ts | 14 +++++++++----- ui/lib/lighthouse/prompts.ts | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/lib/lighthouse/data.ts b/ui/lib/lighthouse/data.ts index 9b1569f3f1..01da0f7245 100644 --- a/ui/lib/lighthouse/data.ts +++ b/ui/lib/lighthouse/data.ts @@ -77,9 +77,12 @@ Email: ${userData.email} Company: ${userData.company} **CURRENT PROVIDER DATA:** -${providersWithScans - .map( - (provider, index) => ` +${ + providersWithScans.length === 0 + ? "No Providers Connected" + : providersWithScans + .map( + (provider, index) => ` Provider ${index + 1}: - Name: ${provider.name} - Type: ${provider.provider_type} @@ -94,8 +97,9 @@ ${ : "- No completed scans found" } `, - ) - .join("\n")} + ) + .join("\n") +} `; } catch (error) { console.error("Failed to retrieve current data:", error); diff --git a/ui/lib/lighthouse/prompts.ts b/ui/lib/lighthouse/prompts.ts index 3dfcc8c965..318ac1479d 100644 --- a/ui/lib/lighthouse/prompts.ts +++ b/ui/lib/lighthouse/prompts.ts @@ -47,6 +47,7 @@ You use Prowler tool's capabilities to answer the user's query. - Always use business context and goals before answering questions on improving cloud security posture. - When the user asks questions without mentioning a specific provider or scan ID, pass all relevant data to downstream agents as an array of objects. - If the necessary data (like the latest scan ID, provider ID, etc) is already in the prompt, don't use tools to retrieve it. +- Queries on resource/findings can be only answered if there are providers connected and these providers have completed scans. ## Operation Steps