fix: clear stale OAuth fields when switching to non-OAuth preset, show expected tools on empty spec

This commit is contained in:
Ishaan Jaffer 2026-03-10 13:30:50 -07:00
parent c96f62d9f4
commit 36829d02ef
2 changed files with 22 additions and 7 deletions

View file

@ -37,6 +37,11 @@ const OpenAPIFormSection: React.FC<OpenAPIFormSectionProps> = ({
updates.auth_type = AUTH_TYPE.OAUTH2;
updates.authorization_url = entry.oauth.authorization_url;
updates.token_url = entry.oauth.token_url;
} else {
// Clear stale OAuth config from previous preset selection
updates.auth_type = undefined;
updates.authorization_url = undefined;
updates.token_url = undefined;
}
form.setFieldsValue(updates);
onValuesChange(updates);

View file

@ -396,13 +396,23 @@ const MCPToolConfiguration: React.FC<MCPToolConfigurationProps> = ({
)}
{/* No tools state */}
{!isLoadingTools && !toolsError && tools.length === 0 && canFetchTools && (!keyTools || keyTools.length === 0) && (
<div className="text-center py-6 text-gray-400 border rounded-lg border-dashed">
<ToolOutlined className="text-2xl mb-2" />
<Text>No tools available for configuration</Text>
<br />
<Text className="text-sm">Connect to an MCP server with tools to configure them</Text>
</div>
{!isLoadingTools && !toolsError && tools.length === 0 && canFetchTools && (
keyTools && keyTools.length > 0 ? (
<div className="text-center py-4 text-gray-400 border rounded-lg border-dashed">
<ToolOutlined className="text-2xl mb-2" />
<Text>No tools loaded from spec</Text>
<Text className="text-sm block mt-1">
Expected tools: {keyTools.map((t) => t.name).join(", ")}
</Text>
</div>
) : (
<div className="text-center py-6 text-gray-400 border rounded-lg border-dashed">
<ToolOutlined className="text-2xl mb-2" />
<Text>No tools available for configuration</Text>
<br />
<Text className="text-sm">Connect to an MCP server with tools to configure them</Text>
</div>
)
)}
{/* Incomplete form state */}