MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / findMatchingResourceOrTemplate

Function findMatchingResourceOrTemplate

webview-ui/src/utils/mcp.ts:34–45  ·  view source on GitHub ↗
(
	uri: string,
	resources: McpResource[] = [],
	templates: McpResourceTemplate[] = [],
)

Source from the content-addressed store, hash-verified

32 * @returns The matching resource, template, or undefined
33 */
34export function findMatchingResourceOrTemplate(
35 uri: string,
36 resources: McpResource[] = [],
37 templates: McpResourceTemplate[] = [],
38): McpResource | McpResourceTemplate | undefined {
39 // First try to find an exact resource match
40 const exactMatch = resources.find((resource) => resource.uri === uri)
41 if (exactMatch) return exactMatch
42
43 // If no exact match, try to find a matching template
44 return findMatchingTemplate(uri, templates)
45}

Callers 1

ChatRowContentFunction · 0.90

Calls 1

findMatchingTemplateFunction · 0.85

Tested by

no test coverage detected