Merge pull request #645 from modelcontextprotocol/ihrpr/remove-custom-title-util

remove hasCustomTitle
This commit is contained in:
Inna Harper 2025-06-17 12:42:42 +01:00 • committed by GitHub
commit 3e95a8b6a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,7 +15,7 @@ export function getDisplayName(metadata: BaseMetadata): string {
if (metadata.title !== undefined && metadata.title !== '') {
return metadata.title;
}
// Then check for annotations.title (only present in Tool objects)
if ('annotations' in metadata) {
const metadataWithAnnotations = metadata as BaseMetadata & { annotations?: { title?: string } };
@ -23,14 +23,7 @@ export function getDisplayName(metadata: BaseMetadata): string {
return metadataWithAnnotations.annotations.title;
}
}
// Finally fall back to name
return metadata.name;
}
/**
* Checks if an object has a custom title different from its name.
*/
export function hasCustomTitle(metadata: BaseMetadata): boolean {
return metadata.title !== undefined && metadata.title !== metadata.name;
}