Skip to content

Commit f5b3e21

Browse files
Consistency in acceptable length of Tool Names (#651)
Signed-off-by: Mohan Lakshmaiah <[email protected]> Co-authored-by: Mohan Lakshmaiah <[email protected]>
1 parent 182cde8 commit f5b3e21

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

mcpgateway/admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,7 @@ async def admin_ui(
13261326
gateways = [gateway.model_dump(by_alias=True) for gateway in await gateway_service.list_gateways(db, include_inactive=include_inactive)]
13271327
roots = [root.model_dump(by_alias=True) for root in await root_service.list_roots()]
13281328
root_path = settings.app_root_path
1329+
max_name_length = settings.validation_max_name_length
13291330
response = request.app.state.templates.TemplateResponse(
13301331
request,
13311332
"admin.html",
@@ -1339,6 +1340,7 @@ async def admin_ui(
13391340
"roots": roots,
13401341
"include_inactive": include_inactive,
13411342
"root_path": root_path,
1343+
"max_name_length": max_name_length,
13421344
"gateway_tool_name_separator": settings.gateway_tool_name_separator,
13431345
},
13441346
)

mcpgateway/static/admin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ function validateInputName(name, type = "input") {
6969
return { valid: false, error: `${type} name cannot be empty` };
7070
}
7171

72-
if (cleaned.length > 100) {
72+
if (cleaned.length > window.MAX_NAME_LENGTH) {
7373
return {
7474
valid: false,
75-
error: `${type} name must be 100 characters or less`,
75+
error: `${type} name must be ${window.MAX_NAME_LENGTH} characters or less`,
7676
};
7777
}
7878

mcpgateway/templates/admin.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,7 @@ <h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">
33083308

33093309
window.ROOT_PATH = {{ root_path | tojson }};
33103310
window.GATEWAY_TOOL_NAME_SEPARATOR = {{ gateway_tool_name_separator | tojson }};
3311+
window.MAX_NAME_LENGTH = {{ max_name_length | tojson }};
33113312
</script>
33123313
</body>
33133314
</html>

0 commit comments

Comments
 (0)