(metadata: BaseMetadata | (BaseMetadata & { annotations?: { title?: string } }))
| 11 | * This implements the spec requirement: "if no title is provided, name should be used for display purposes" |
| 12 | */ |
| 13 | export function getDisplayName(metadata: BaseMetadata | (BaseMetadata & { annotations?: { title?: string } })): string { |
| 14 | // First check for title (not undefined and not empty string) |
| 15 | if (metadata.title !== undefined && metadata.title !== '') { |
| 16 | return metadata.title; |
| 17 | } |
| 18 | |
| 19 | // Then check for annotations.title (only present in Tool objects) |
| 20 | if ('annotations' in metadata && metadata.annotations?.title) { |
| 21 | return metadata.annotations.title; |
| 22 | } |
| 23 | |
| 24 | // Finally fall back to name |
| 25 | return metadata.name; |
| 26 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…