Skip to content

Commit 1d60ec7

Browse files
authored
Merge pull request #341 from OpenAgentPlatform/fix-config-streamable
fix: prevent premature URL validation error when configuring streamab…
2 parents c3a66a8 + 417af07 commit 1d60ec7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/views/Overlay/Tools/Popup/CustomEdit.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ const CustomEdit = React.memo(({ _type, _config, _toolName, onDelete, onCancel,
800800
newMcpServers = newMcpServers.mcpServers
801801
}
802802
// If transport is streamable, check if url is valid
803-
if(newMcpServers.transport === "streamable" | newMcpServers.transport === "sse") {
803+
if(newMcpServers.transport === "streamable" || newMcpServers.transport === "sse") {
804804
const urlValue = newMcpServers.url?.trim() || ""
805805
if(!urlValue) {
806806
return { isError: true, text: `tools.jsonFormatError.urlRequired${newMcpServers.transport}`, fieldKey: "url" }
@@ -1116,10 +1116,10 @@ const CustomEdit = React.memo(({ _type, _config, _toolName, onDelete, onCancel,
11161116
size="small"
11171117
type="text"
11181118
value={currentMcpServers.command || ""}
1119-
error={currentMcp.name && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command"}
1119+
error={currentMcp.name && (currentMcpServers.command || currentMcpServers.url) && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command"}
11201120
onChange={(e) => handleCustomChange("command", e.target.value)}
11211121
/>
1122-
{currentMcp.name && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command" ? (
1122+
{currentMcp.name && (currentMcpServers.command || currentMcpServers.url) && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command" ? (
11231123
<Tooltip content={t(isValidCommandOrUrl(currentMcpServers)?.text, { mcp: currentMcp.name })} side="left">
11241124
<div
11251125
className="key-input-error"
@@ -1387,10 +1387,10 @@ const CustomEdit = React.memo(({ _type, _config, _toolName, onDelete, onCancel,
13871387
size="small"
13881388
type="text"
13891389
value={currentMcpServers.url || ""}
1390-
error={currentMcp.name && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "url"}
1390+
error={currentMcp.name && currentMcpServers.url && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "url"}
13911391
onChange={(e) => handleCustomChange("url", e.target.value)}
13921392
/>
1393-
{currentMcp.name && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "url" ? (
1393+
{currentMcp.name && currentMcpServers.url && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "url" ? (
13941394
<Tooltip content={t(isValidCommandOrUrl(currentMcpServers)?.text, { mcp: currentMcp.name })} side="left">
13951395
<div
13961396
className="key-input-error"

0 commit comments

Comments
 (0)