MCPcopy Index your code
hub / github.com/simstudioai/sim / normalizeUrlForHashing

Function normalizeUrlForHashing

apps/sim/lib/mcp/utils.ts:226–234  ·  view source on GitHub ↗

* Normalize URL for consistent hashing. * - Converts to lowercase * - Removes trailing slashes * - Removes query parameters and fragments

(url: string)

Source from the content-addressed store, hash-verified

224 * - Removes query parameters and fragments
225 */
226function normalizeUrlForHashing(url: string): string {
227 try {
228 const parsed = new URL(url)
229 const normalized = `${parsed.origin}${parsed.pathname}`.toLowerCase().replace(/\/+$/, '')
230 return normalized
231 } catch {
232 return url.toLowerCase().trim().replace(/\/+$/, '')
233 }
234}
235
236/**
237 * Simple deterministic hash function that produces an 8-character hex string.

Callers 1

generateMcpServerIdFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected