function envelopeFigure(host) {
ensureStyles();
var shapes = [
{ title: 'request', l1: 'id required', l2: 'not null' },
{ title: 'notification', l1: 'no id field', l2: 'no reply sent' },
{ title: 'result', l1: 'id matches call', l2: 'has resultType' },
{ title: 'error', l1: 'id if readable', l2: 'code + message' }
];
var cardW = 120;
var gap = 12;
var startX = 18;
var cards = '';
var i;
var x;
for (i = 0; i < shapes.length; i++) {
x = startX + i * (cardW + gap);
cards += '';
cards += '' + shapes[i].title + '';
cards += '' + shapes[i].l1 + '';
cards += '' + shapes[i].l2 + '';
}
function seg(text, x0, cls, y) {
var w = text.length * 7.2;
return { markup: '' + text + '', next: x0 + w, width: w, x0: x0 };
}
var a1 = seg('io.', 18, 'l03p', 136);
var a2 = seg('modelcontextprotocol', a1.next, 'l03chk', 136);
var a3 = seg('/protocolVersion', a2.next, 'l03p', 136);
var reservedHighlight = '';
var b1 = seg('com.', 18, 'l03p', 182);
var b2 = seg('example', b1.next, 'l03chk', 182);
var b3 = seg('.mcp/scanId', b2.next, 'l03p', 182);
var freeHighlight = '';
var shell = document.createElement('div');
shell.className = 'mf-shell';
shell.innerHTML = [
'
The JSON-RPC Envelope four message shapes and the _meta key anatomy
',
'
',
'',
'
',
'
A request always carries a non-null id, a notification never carries one, and a result or error echoes the id it answers. A _meta key is reserved for MCP only when its second dot-separated label is modelcontextprotocol or mcp, wherever mcp itself might also appear.