MCPcopy Create free account
hub / github.com/modelcontextprotocol/inspector / getPrefixSegment

Function getPrefixSegment

client/src/utils/metaUtils.ts:27–34  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

25 * @see https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta
26 */
27const getPrefixSegment = (key: string): string | null => {
28 const trimmedKey = key.trim();
29 const slashIndex = trimmedKey.indexOf("/");
30 if (slashIndex === -1) {
31 return null;
32 }
33 return trimmedKey.slice(0, slashIndex);
34};
35
36/**
37 * Normalizes a potential prefix segment by trimming whitespace, removing schemes,

Callers 2

isReservedMetaKeyFunction · 0.85
hasValidMetaPrefixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected