MCPcopy Create free account
hub / github.com/codeaashu/claude-code / extractMcpToolDisplayName

Function extractMcpToolDisplayName

src/services/mcp/mcpStringUtils.ts:88–106  ·  view source on GitHub ↗
(userFacingName: string)

Source from the content-addressed store, hash-verified

86 * @returns The display name without server prefix and (MCP) suffix
87 */
88export function extractMcpToolDisplayName(userFacingName: string): string {
89 // This is really ugly but our current Tool type doesn't make it easy to have different display names for different purposes.
90
91 // First, remove the (MCP) suffix if present
92 let withoutSuffix = userFacingName.replace(/\s*\(MCP\)\s*$/, '')
93
94 // Trim the result
95 withoutSuffix = withoutSuffix.trim()
96
97 // Then, remove the server prefix (everything before " - ")
98 const dashIndex = withoutSuffix.indexOf(' - ')
99 if (dashIndex !== -1) {
100 const displayName = withoutSuffix.substring(dashIndex + 3).trim()
101 return displayName
102 }
103
104 // If no dash found, return the string without (MCP)
105 return withoutSuffix
106}
107

Callers 2

MCPToolDetailViewFunction · 0.85
MCPToolListViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected