From 39675434f6686c9e3793319a4991a63980fb7e4a Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 2 Oct 2025 01:29:44 -0500 Subject: [PATCH] refac: external tool validation --- src/lib/components/AddToolServerModal.svelte | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/components/AddToolServerModal.svelte b/src/lib/components/AddToolServerModal.svelte index 08489348b3..21ce63f014 100644 --- a/src/lib/components/AddToolServerModal.svelte +++ b/src/lib/components/AddToolServerModal.svelte @@ -98,9 +98,16 @@ return; } - if (path === '') { - toast.error($i18n.t('Please enter a valid path')); - return; + if (['openapi', ''].includes(type)) { + if (spec_type === 'json' && spec === '') { + toast.error($i18n.t('Please enter a valid JSON spec')); + return; + } + + if (spec_type === 'url' && path === '') { + toast.error($i18n.t('Please enter a valid path')); + return; + } } if (direct) {