From 545c21b1966db0c19ec6369779c1438fd0b66df8 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 11 Jul 2025 13:51:31 +0800 Subject: [PATCH] feat(oauth): clean up imports and streamline OAuth client parameter retrieval --- api/controllers/console/workspace/tool_providers.py | 8 ++------ api/core/tools/tool_manager.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/api/controllers/console/workspace/tool_providers.py b/api/controllers/console/workspace/tool_providers.py index 666759a566..bdcd5acdf3 100644 --- a/api/controllers/console/workspace/tool_providers.py +++ b/api/controllers/console/workspace/tool_providers.py @@ -1,7 +1,6 @@ import io from urllib.parse import urlparse -from flask import redirect, send_file from flask import make_response, redirect, request, send_file from flask_login import current_user from flask_restful import ( @@ -18,7 +17,6 @@ from controllers.console.wraps import ( enterprise_license_required, setup_required, ) -from controllers.console.wraps import account_initialization_required, enterprise_license_required, setup_required from core.mcp.auth.auth_flow import auth, handle_callback from core.mcp.auth.auth_provider import OAuthClientProvider from core.mcp.error import MCPAuthError, MCPError @@ -695,10 +693,7 @@ class ToolPluginOAuthApi(Resource): raise Forbidden() tenant_id = user.current_tenant_id - oauth_client_params = BuiltinToolManageService.get_oauth_client( - tenant_id=tenant_id, - provider=provider - ) + oauth_client_params = BuiltinToolManageService.get_oauth_client(tenant_id=tenant_id, provider=provider) if oauth_client_params is None: raise Forbidden("no oauth available client config found for this tool provider") @@ -851,6 +846,7 @@ api.add_resource(ToolOAuthCallback, "/oauth/plugin//tool/callback api.add_resource(ToolOAuthCustomClient, "/workspaces/current/tool-provider/builtin//oauth/custom-client") + class ToolProviderMCPApi(Resource): @setup_required @login_required diff --git a/api/core/tools/tool_manager.py b/api/core/tools/tool_manager.py index f96aac81bb..9d5000f8d4 100644 --- a/api/core/tools/tool_manager.py +++ b/api/core/tools/tool_manager.py @@ -46,7 +46,7 @@ from core.tools.entities.tool_entities import ( ToolParameter, ToolProviderType, ) -from core.tools.errors import ToolNotFoundError, ToolProviderNotFoundError +from core.tools.errors import ToolProviderNotFoundError from core.tools.tool_label_manager import ToolLabelManager from core.tools.utils.configuration import ( ToolParameterConfigurationManager,