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

Function splitLabels

client/src/utils/metaUtils.ts:74–87  ·  view source on GitHub ↗
(segment: string)

Source from the content-addressed store, hash-verified

72 * @see https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta
73 */
74const splitLabels = (segment: string): string[] | null => {
75 const normalized = normalizeSegment(segment);
76 if (!normalized) return null;
77
78 const labels = normalized.split(".");
79 if (
80 labels.length === 0 ||
81 labels.some((label) => !label || !META_PREFIX_LABEL_REGEX.test(label))
82 ) {
83 return null;
84 }
85
86 return labels;
87};
88
89/**
90 * Determines whether a metadata key is within the MCP-reserved namespace.

Callers 2

isReservedMetaKeyFunction · 0.85
hasValidMetaPrefixFunction · 0.85

Calls 1

normalizeSegmentFunction · 0.85

Tested by

no test coverage detected