Skip to content

Commit b0c2582

Browse files
authored
truncating long tool description (#717)
Signed-off-by: Shoumi <[email protected]>
1 parent 66cba0d commit b0c2582

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mcpgateway/templates/admin.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,13 @@ <h2 class="text-2xl font-bold dark:text-gray-200">
765765
<td
766766
class="px-2 py-4 whitespace-normal break-words text-sm text-gray-500 dark:text-gray-300"
767767
>
768-
{{ tool.description | replace('\n', '<br />') | safe }}
768+
{% set clean_desc = (tool.description or "") | replace('\n', ' ') | replace('\r', ' ') %}
769+
{% set refactor_desc = clean_desc | striptags | trim | escape %}
770+
{% if refactor_desc | length is greaterthan 120 %}
771+
{{ refactor_desc[:120] }}...
772+
{% else %}
773+
{{ refactor_desc }}
774+
{% endif %}
769775
</td>
770776
<td class="px-2 py-4 whitespace-nowrap">
771777
{% if tool.annotations %} {% if tool.annotations.title %}

0 commit comments

Comments
 (0)