mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-09 22:31:08 +00:00
Add getMcpServerDisplayName
This commit is contained in:
parent
a01471f469
commit
000b4af458
1 changed files with 23 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { McpResource, McpResourceTemplate } from "../../../src/shared/mcp"
|
||||
import { McpMarketplaceCatalog, McpResource, McpResourceTemplate } from "../../../src/shared/mcp"
|
||||
|
||||
/**
|
||||
* Matches a URI against an array of URI templates and returns the matching template
|
||||
|
|
@ -40,3 +40,25 @@ export function findMatchingResourceOrTemplate(
|
|||
// If no exact match, try to find a matching template
|
||||
return findMatchingTemplate(uri, templates)
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to convert an MCP server name to its display name using the marketplace catalog
|
||||
* @param serverName The server name/ID to look up
|
||||
* @param mcpMarketplaceCatalog The marketplace catalog containing server metadata
|
||||
* @returns The display name if found in catalog, otherwise returns the original server name
|
||||
*/
|
||||
export function getMcpServerDisplayName(serverName: string, mcpMarketplaceCatalog: McpMarketplaceCatalog): string {
|
||||
// Find matching item in marketplace catalog
|
||||
const catalogItem = mcpMarketplaceCatalog.items.find((item) => item.mcpId === serverName)
|
||||
// Log if no matching catalog item found
|
||||
if (!catalogItem) {
|
||||
console.warn(`No marketplace catalog item found for MCP server: ${serverName}`)
|
||||
} else {
|
||||
console.log(`Found marketplace catalog item for MCP server: ${serverName}`, catalogItem)
|
||||
}
|
||||
|
||||
console.log(mcpMarketplaceCatalog)
|
||||
|
||||
// Return display name if found, otherwise return original server name
|
||||
return catalogItem?.name || serverName
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue