Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(api): type tool service dicts with TypedDict (#33836)
BitToby55cc24fed79e
diff --git a/api/services/tools/api_tools_manage_service.py b/api/services/tools/api_tools_manage_service.pyindex dc883f0daa8..408b1c22d17 100644--- a/api/services/tools/api_tools_manage_service.py+++ b/api/services/tools/api_tools_manage_service.py@@ -1,10 +1,10 @@import jsonimport logging-from collections.abc import Mappingfrom typing import Any, castfrom httpx import getfrom sqlalchemy import select+from typing_extensions import TypedDictfrom core.entities.provider_entities import ProviderConfigfrom core.tools.__base.tool_runtime import ToolRuntime@@ -28,9 +28,16 @@ from services.tools.tools_transform_service import ToolTransformServicelogger = logging.getLogger(__name__)+class ApiSchemaParseResult(TypedDict):+ schema_type: str+ parameters_schema: list[dict[str, Any]]+ credentials_schema: list[dict[str, Any]]+ warning: dict[str, str]++class ApiToolManageService:@staticmethod- def parser_api_schema(schema: str) -> Mapping[str, Any]:+ def parser_api_schema(schema: str) -> ApiSchemaParseResult:"""parse api schema to tool bundle"""@@ -71,7 +78,7 @@ class ApiToolManageService:]return cast(- Mapping,+ ApiSchemaParseResult,jsonable_encoder({"schema_type": schema_type,diff --git a/api/services/tools/mcp_tools_manage_service.py b/api/services/tools/mcp_tools_manage_service.pyindex 0be106f5977..388ba8a8405 100644--- a/api/services/tools/mcp_tools_manage_service.py+++ b/api/services/tools/mcp_tools_manage_service.py@@ -18,6 +18,7 @@ from core.helper.provider_cache import NoOpProviderCredentialCachefrom core.mcp.auth.auth_flow import authfrom core.mcp.auth_client import MCPClientWithAuthRetryfrom core.mcp.error import MCPAuthError, MCPError+from core.mcp.types import Tool as MCPToolfrom core.tools.entities.api_entities import ToolProviderApiEntityfrom core.tools.utils.encryption import ProviderConfigEncrypterfrom models.tools import MCPToolProvider@@ -681,7 +682,7 @@ class MCPToolManageService:raise ValueError(f"Failed to re-connect MCP server: {e}") from edef _build_tool_provider_response(- self, db_provider: MCPToolProvider, provider_entity: MCPProviderEntity, tools: list+ self, db_provider: MCPToolProvider, provider_entity: MCPProviderEntity, tools: list[MCPTool]) -> ToolProviderApiEntity:"""Build API response for tool provider."""user = db_provider.load_user()