@@ -1512,7 +1512,7 @@ async def admin_ui(
15121512 >>> mock_tool = ToolRead(
15131513 ... id="t1", name="T1", original_name="T1", url="http://t1.com", description="d",
15141514 ... created_at=datetime.now(timezone.utc), updated_at=datetime.now(timezone.utc),
1515- ... enabled=True, reachable=True, gateway_slug="default", original_name_slug ="t1",
1515+ ... enabled=True, reachable=True, gateway_slug="default", custom_name_slug ="t1",
15161516 ... request_type="GET", integration_type="MCP", headers={}, input_schema={},
15171517 ... annotations={}, jsonpath_filter=None, auth=None, execution_count=0,
15181518 ... metrics=ToolMetrics(
@@ -1521,6 +1521,7 @@ async def admin_ui(
15211521 ... avg_response_time=0.0, last_execution_time=None
15221522 ... ),
15231523 ... gateway_id=None,
1524+ ... customName="T1",
15241525 ... tags=[]
15251526 ... )
15261527 >>> server_service.list_servers = AsyncMock(return_value=[mock_server])
@@ -1633,34 +1634,35 @@ async def admin_list_tools(
16331634 >>> mock_user = "test_user"
16341635 >>>
16351636 >>> # Mock tool data
1636- >>> mock_tool = ToolRead(
1637- ... id="tool-1",
1638- ... name="Test Tool",
1639- ... original_name="TestTool",
1640- ... url="http://test.com/tool",
1641- ... description="A test tool",
1642- ... request_type="HTTP",
1643- ... integration_type="MCP",
1644- ... headers={},
1645- ... input_schema={},
1646- ... annotations={},
1647- ... jsonpath_filter=None,
1648- ... auth=None,
1649- ... created_at=datetime.now(timezone.utc),
1650- ... updated_at=datetime.now(timezone.utc),
1651- ... enabled=True,
1652- ... reachable=True,
1653- ... gateway_id=None,
1654- ... execution_count=0,
1655- ... metrics=ToolMetrics(
1656- ... total_executions=5, successful_executions=5, failed_executions=0,
1657- ... failure_rate=0.0, min_response_time=0.1, max_response_time=0.5,
1658- ... avg_response_time=0.3, last_execution_time=datetime.now(timezone.utc)
1659- ... ),
1660- ... gateway_slug="default",
1661- ... original_name_slug="test-tool",
1662- ... tags=[]
1663- ... ) # Added gateway_id=None
1637+ >>> mock_tool = ToolRead(
1638+ ... id="tool-1",
1639+ ... name="Test Tool",
1640+ ... original_name="TestTool",
1641+ ... url="http://test.com/tool",
1642+ ... description="A test tool",
1643+ ... request_type="HTTP",
1644+ ... integration_type="MCP",
1645+ ... headers={},
1646+ ... input_schema={},
1647+ ... annotations={},
1648+ ... jsonpath_filter=None,
1649+ ... auth=None,
1650+ ... created_at=datetime.now(timezone.utc),
1651+ ... updated_at=datetime.now(timezone.utc),
1652+ ... enabled=True,
1653+ ... reachable=True,
1654+ ... gateway_id=None,
1655+ ... execution_count=0,
1656+ ... metrics=ToolMetrics(
1657+ ... total_executions=5, successful_executions=5, failed_executions=0,
1658+ ... failure_rate=0.0, min_response_time=0.1, max_response_time=0.5,
1659+ ... avg_response_time=0.3, last_execution_time=datetime.now(timezone.utc)
1660+ ... ),
1661+ ... gateway_slug="default",
1662+ ... custom_name_slug="test-tool",
1663+ ... customName="Test Tool",
1664+ ... tags=[]
1665+ ... ) # Added gateway_id=None
16641666 >>>
16651667 >>> # Mock the tool_service.list_tools method
16661668 >>> original_list_tools = tool_service.list_tools
@@ -1686,7 +1688,8 @@ async def admin_list_tools(
16861688 ... failure_rate=0.0, min_response_time=0.0, max_response_time=0.0,
16871689 ... avg_response_time=0.0, last_execution_time=None
16881690 ... ),
1689- ... gateway_slug="default", original_name_slug="inactive-tool",
1691+ ... gateway_slug="default", custom_name_slug="inactive-tool",
1692+ ... customName="Inactive Tool",
16901693 ... tags=[]
16911694 ... )
16921695 >>> tool_service.list_tools = AsyncMock(return_value=[mock_tool, mock_inactive_tool])
@@ -1772,7 +1775,8 @@ async def admin_get_tool(tool_id: str, db: Session = Depends(get_db), user: str
17721775 ... failure_rate=0.0, min_response_time=0.0, max_response_time=0.0, avg_response_time=0.0,
17731776 ... last_execution_time=None
17741777 ... ),
1775- ... gateway_slug="default", original_name_slug="get-tool",
1778+ ... gateway_slug="default", custom_name_slug="get-tool",
1779+ ... customName="Get Tool",
17761780 ... tags=[]
17771781 ... )
17781782 >>>
@@ -2088,6 +2092,7 @@ async def admin_edit_tool(
20882092 >>> # Happy path: Edit tool successfully
20892093 >>> form_data_success = FormData([
20902094 ... ("name", "Updated_Tool"),
2095+ ... ("customName", "ValidToolName"),
20912096 ... ("url", "http://updated.com"),
20922097 ... ("requestType", "GET"),
20932098 ... ("integrationType", "REST"),
@@ -2110,6 +2115,7 @@ async def admin_edit_tool(
21102115 >>> # Edge case: Edit tool with inactive checkbox checked
21112116 >>> form_data_inactive = FormData([
21122117 ... ("name", "Inactive_Edit"),
2118+ ... ("customName", "ValidToolName"),
21132119 ... ("url", "http://inactive.com"),
21142120 ... ("is_inactive_checked", "true"),
21152121 ... ("requestType", "GET"),
@@ -2128,6 +2134,7 @@ async def admin_edit_tool(
21282134 >>> # Error path: Tool name conflict (simulated with IntegrityError)
21292135 >>> form_data_conflict = FormData([
21302136 ... ("name", "Conflicting_Name"),
2137+ ... ("customName", "Conflicting_Name"),
21312138 ... ("url", "http://conflict.com"),
21322139 ... ("requestType", "GET"),
21332140 ... ("integrationType", "REST")
@@ -2146,6 +2153,7 @@ async def admin_edit_tool(
21462153 >>> # Error path: ToolError raised
21472154 >>> form_data_tool_error = FormData([
21482155 ... ("name", "Tool_Error"),
2156+ ... ("customName", "Tool_Error"),
21492157 ... ("url", "http://toolerror.com"),
21502158 ... ("requestType", "GET"),
21512159 ... ("integrationType", "REST")
@@ -2164,6 +2172,7 @@ async def admin_edit_tool(
21642172 >>> # Error path: Pydantic Validation Error
21652173 >>> form_data_validation_error = FormData([
21662174 ... ("name", "Bad_URL"),
2175+ ... ("customName","Bad_Custom_Name"),
21672176 ... ("url", "not-a-valid-url"),
21682177 ... ("requestType", "GET"),
21692178 ... ("integrationType", "REST")
@@ -2181,6 +2190,7 @@ async def admin_edit_tool(
21812190 >>> # Error path: Unexpected exception
21822191 >>> form_data_unexpected = FormData([
21832192 ... ("name", "Crash_Tool"),
2193+ ... ("customName", "Crash_Tool"),
21842194 ... ("url", "http://crash.com"),
21852195 ... ("requestType", "GET"),
21862196 ... ("integrationType", "REST")
@@ -2202,13 +2212,13 @@ async def admin_edit_tool(
22022212 """
22032213 LOGGER .debug (f"User { user } is editing tool ID { tool_id } " )
22042214 form = await request .form ()
2205-
22062215 # Parse tags from comma-separated string
22072216 tags_str = str (form .get ("tags" , "" ))
22082217 tags : list [str ] = [tag .strip () for tag in tags_str .split ("," ) if tag .strip ()] if tags_str else []
22092218
22102219 tool_data : dict [str , Any ] = {
22112220 "name" : form .get ("name" ),
2221+ "custom_name" : form .get ("customName" ),
22122222 "url" : form .get ("url" ),
22132223 "description" : form .get ("description" ),
22142224 "headers" : json .loads (form .get ("headers" ) or "{}" ),
0 commit comments