@@ -503,17 +503,35 @@ const ACRONYM_CASING: Record<string, string> = {
503503}
504504
505505/**
506- * Final fallback: humanize a raw tool name (e.g. `manage_folder` -> "Manage
507- * Folder"), matching the legacy client humanizer so labels never render blank.
506+ * Humanize an internal identifier without leaking snake_case or kebab-case into
507+ * the UI. Sentence case is useful for resource names appended to a verb, while
508+ * title case is used for standalone tool-name fallbacks.
508509 */
509- export function humanizeToolName ( name : string ) : string {
510- const words = stripVersionSuffix ( name ) . split ( '_' ) . filter ( Boolean )
510+ export function humanizeDisplayIdentifier (
511+ name : string ,
512+ casing : 'sentence' | 'title' = 'title'
513+ ) : string {
514+ const words = stripVersionSuffix ( name ) . split ( / [ - _ ] + / ) . filter ( Boolean )
511515 if ( words . length === 0 ) return name
512516 return words
513- . map ( ( word ) => ACRONYM_CASING [ word ] ?? word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 ) )
517+ . map ( ( word , index ) => {
518+ const normalized = word . toLowerCase ( )
519+ const acronym = ACRONYM_CASING [ normalized ]
520+ if ( acronym ) return acronym
521+ if ( casing === 'sentence' && index > 0 ) return normalized
522+ return normalized . charAt ( 0 ) . toUpperCase ( ) + normalized . slice ( 1 )
523+ } )
514524 . join ( ' ' )
515525}
516526
527+ /**
528+ * Final fallback: humanize a raw tool name (e.g. `manage_folder` -> "Manage
529+ * Folder"), matching the legacy client humanizer so labels never render blank.
530+ */
531+ export function humanizeToolName ( name : string ) : string {
532+ return humanizeDisplayIdentifier ( name )
533+ }
534+
517535/**
518536 * Resolve a tool-call display title from its name and arguments. Argument-aware
519537 * cases come first, then the static map, then a humanized fallback. This never
@@ -846,6 +864,7 @@ const COMPLETED_VERB_REWRITES: Record<string, string> = {
846864 Scraping : 'Scraped' ,
847865 Searching : 'Searched' ,
848866 Setting : 'Set' ,
867+ Summarizing : 'Summarized' ,
849868 Syncing : 'Synced' ,
850869 Toggling : 'Toggled' ,
851870 Trimming : 'Trimmed' ,
0 commit comments