UNPKG

@jupiterone/jupiterone-mcp

Version:

Model Context Protocol server for JupiterOne account rules and rule details

27 lines 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.structuredResult = structuredResult; /** * Builds a success result with both channels (P1): * - `structuredContent`: the typed payload — for code-mode consumers and future MCP Apps UI * (it becomes the UI's data prop), validated against the tool's outputSchema by the SDK. * - `content`: the same payload as JSON text — the model-facing and text-only-host fallback the * spec requires ("tools MUST return a meaningful content array even when UI is available"). * * The two channels are semantically equivalent (per SEP-1624); clients choose which to forward to * the model. Error paths do NOT use this — they return content-only `isError` results, which the * SDK exempts from output-schema validation. */ function structuredResult(payload) { // Normalize once through JSON so the two channels are byte-identical and free of `undefined` // (which JSON.stringify drops and JSON Schema can't represent). Building payloads from optional // API fields commonly leaves keys `undefined`; without this, `content` would omit them while // `structuredContent` kept them, diverging the channels and risking outputSchema validation // failures. const text = JSON.stringify(payload); return { content: [{ type: 'text', text }], structuredContent: JSON.parse(text), }; } //# sourceMappingURL=result.js.map