@@ -1512,7 +1512,7 @@ async def admin_ui(
1512
1512
>>> mock_tool = ToolRead(
1513
1513
... id="t1", name="T1", original_name="T1", url="http://t1.com", description="d",
1514
1514
... 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",
1516
1516
... request_type="GET", integration_type="MCP", headers={}, input_schema={},
1517
1517
... annotations={}, jsonpath_filter=None, auth=None, execution_count=0,
1518
1518
... metrics=ToolMetrics(
@@ -1521,6 +1521,7 @@ async def admin_ui(
1521
1521
... avg_response_time=0.0, last_execution_time=None
1522
1522
... ),
1523
1523
... gateway_id=None,
1524
+ ... customName="T1",
1524
1525
... tags=[]
1525
1526
... )
1526
1527
>>> server_service.list_servers = AsyncMock(return_value=[mock_server])
@@ -1633,34 +1634,35 @@ async def admin_list_tools(
1633
1634
>>> mock_user = "test_user"
1634
1635
>>>
1635
1636
>>> # 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
1664
1666
>>>
1665
1667
>>> # Mock the tool_service.list_tools method
1666
1668
>>> original_list_tools = tool_service.list_tools
@@ -1686,7 +1688,8 @@ async def admin_list_tools(
1686
1688
... failure_rate=0.0, min_response_time=0.0, max_response_time=0.0,
1687
1689
... avg_response_time=0.0, last_execution_time=None
1688
1690
... ),
1689
- ... gateway_slug="default", original_name_slug="inactive-tool",
1691
+ ... gateway_slug="default", custom_name_slug="inactive-tool",
1692
+ ... customName="Inactive Tool",
1690
1693
... tags=[]
1691
1694
... )
1692
1695
>>> 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
1772
1775
... failure_rate=0.0, min_response_time=0.0, max_response_time=0.0, avg_response_time=0.0,
1773
1776
... last_execution_time=None
1774
1777
... ),
1775
- ... gateway_slug="default", original_name_slug="get-tool",
1778
+ ... gateway_slug="default", custom_name_slug="get-tool",
1779
+ ... customName="Get Tool",
1776
1780
... tags=[]
1777
1781
... )
1778
1782
>>>
@@ -2088,6 +2092,7 @@ async def admin_edit_tool(
2088
2092
>>> # Happy path: Edit tool successfully
2089
2093
>>> form_data_success = FormData([
2090
2094
... ("name", "Updated_Tool"),
2095
+ ... ("customName", "ValidToolName"),
2091
2096
... ("url", "http://updated.com"),
2092
2097
... ("requestType", "GET"),
2093
2098
... ("integrationType", "REST"),
@@ -2110,6 +2115,7 @@ async def admin_edit_tool(
2110
2115
>>> # Edge case: Edit tool with inactive checkbox checked
2111
2116
>>> form_data_inactive = FormData([
2112
2117
... ("name", "Inactive_Edit"),
2118
+ ... ("customName", "ValidToolName"),
2113
2119
... ("url", "http://inactive.com"),
2114
2120
... ("is_inactive_checked", "true"),
2115
2121
... ("requestType", "GET"),
@@ -2128,6 +2134,7 @@ async def admin_edit_tool(
2128
2134
>>> # Error path: Tool name conflict (simulated with IntegrityError)
2129
2135
>>> form_data_conflict = FormData([
2130
2136
... ("name", "Conflicting_Name"),
2137
+ ... ("customName", "Conflicting_Name"),
2131
2138
... ("url", "http://conflict.com"),
2132
2139
... ("requestType", "GET"),
2133
2140
... ("integrationType", "REST")
@@ -2146,6 +2153,7 @@ async def admin_edit_tool(
2146
2153
>>> # Error path: ToolError raised
2147
2154
>>> form_data_tool_error = FormData([
2148
2155
... ("name", "Tool_Error"),
2156
+ ... ("customName", "Tool_Error"),
2149
2157
... ("url", "http://toolerror.com"),
2150
2158
... ("requestType", "GET"),
2151
2159
... ("integrationType", "REST")
@@ -2164,6 +2172,7 @@ async def admin_edit_tool(
2164
2172
>>> # Error path: Pydantic Validation Error
2165
2173
>>> form_data_validation_error = FormData([
2166
2174
... ("name", "Bad_URL"),
2175
+ ... ("customName","Bad_Custom_Name"),
2167
2176
... ("url", "not-a-valid-url"),
2168
2177
... ("requestType", "GET"),
2169
2178
... ("integrationType", "REST")
@@ -2181,6 +2190,7 @@ async def admin_edit_tool(
2181
2190
>>> # Error path: Unexpected exception
2182
2191
>>> form_data_unexpected = FormData([
2183
2192
... ("name", "Crash_Tool"),
2193
+ ... ("customName", "Crash_Tool"),
2184
2194
... ("url", "http://crash.com"),
2185
2195
... ("requestType", "GET"),
2186
2196
... ("integrationType", "REST")
@@ -2202,13 +2212,13 @@ async def admin_edit_tool(
2202
2212
"""
2203
2213
LOGGER .debug (f"User { user } is editing tool ID { tool_id } " )
2204
2214
form = await request .form ()
2205
-
2206
2215
# Parse tags from comma-separated string
2207
2216
tags_str = str (form .get ("tags" , "" ))
2208
2217
tags : list [str ] = [tag .strip () for tag in tags_str .split ("," ) if tag .strip ()] if tags_str else []
2209
2218
2210
2219
tool_data : dict [str , Any ] = {
2211
2220
"name" : form .get ("name" ),
2221
+ "custom_name" : form .get ("customName" ),
2212
2222
"url" : form .get ("url" ),
2213
2223
"description" : form .get ("description" ),
2214
2224
"headers" : json .loads (form .get ("headers" ) or "{}" ),
0 commit comments