@zuplo/runtime 7.4.1 → 7.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15661,12 +15661,69 @@ export declare class ZuploMcpSdk {
15661
15661
  */
15662
15662
  getRawCallToolRequest(): CallToolRequest | null;
15663
15663
  /**
15664
- * Sets the MCP request/response context object.
15665
- * Use this to set `_meta` that should be included in the tool result.
15664
+ * Overrides fields of the MCP tool result the gateway is about to send.
15666
15665
  *
15667
- * @param req - The object containing metadata (e.g. `{ _meta: { ... } }`)
15666
+ * Every field is independently optional; an absent field keeps the value
15667
+ * the gateway derives from the downstream response. The most useful
15668
+ * combination is `content` alone: the human-readable summary replaces the
15669
+ * raw serialized body while `structuredContent` is still auto-derived from
15670
+ * it — one call, compact model context, full data preserved.
15671
+ *
15672
+ * @example A compact summary for the model, full JSON in structuredContent
15673
+ * ```ts
15674
+ * const response = await context.invokeRoute("/todos");
15675
+ * new ZuploMcpSdk(context).setRawCallToolResult({
15676
+ * content: [{ type: "text", text: "Fetched the todo list" }],
15677
+ * });
15678
+ * return response;
15679
+ * ```
15680
+ *
15681
+ * Notes:
15682
+ *
15683
+ * - The stored value is *consumed* when the gateway builds the tool result
15684
+ * (asymmetric with {@link getRawCallToolRequest}, which can be read any
15685
+ * number of times).
15686
+ * - The value is written to the context that carried the matching
15687
+ * `tools/call` request, which is looked up exactly one `invokeRoute`
15688
+ * generation up. Calling this from a grandchild invocation (a route that
15689
+ * itself invokes another route) silently stores the override where the
15690
+ * gateway never reads it.
15691
+ * - `isError` is deliberately not overridable: it follows the status of the
15692
+ * response your handler returns, so upstream failures cannot be masked.
15693
+ * - `structuredContent` must be a JSON object. The MCP 2025-11-25 wire
15694
+ * format rejects arrays and scalars here.
15695
+ * - Declining the spec's backwards-compatibility SHOULD (mirroring
15696
+ * serialized JSON into a text block) has a concrete cost: clients that
15697
+ * predate `structuredContent` see only your summary in `content`.
15698
+ * - MCP reserves `_meta` keys with the `modelcontextprotocol.io/` prefix
15699
+ * for the protocol itself; use your own prefix for application metadata.
15700
+ *
15701
+ * @param result - The fields to override on the tool result
15702
+ */
15703
+ setRawCallToolResult(result: ZuploMcpToolResultOverride): void;
15704
+ }
15705
+
15706
+ /**
15707
+ * The subset of a `tools/call` result a module author may override via
15708
+ * {@link ZuploMcpSdk.setRawCallToolResult}. Every field is independently
15709
+ * optional; an absent field keeps the value the gateway derives from the
15710
+ * downstream response.
15711
+ */
15712
+ export declare interface ZuploMcpToolResultOverride {
15713
+ /**
15714
+ * Content blocks for the model to read. Replaces the gateway's default
15715
+ * (the serialized downstream body in a single text block).
15716
+ */
15717
+ content?: CallToolResult["content"];
15718
+ /**
15719
+ * The structured form of the tool's output. MUST be a JSON object — the
15720
+ * MCP 2025-11-25 wire format rejects arrays/strings/numbers here.
15721
+ */
15722
+ structuredContent?: Record<string, unknown>;
15723
+ /**
15724
+ * Per-call metadata. Replaces the gateway's default of `{}`.
15668
15725
  */
15669
- setRawCallToolResult(req: CallToolResult): void;
15726
+ _meta?: Record<string, unknown>;
15670
15727
  }
15671
15728
 
15672
15729
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.4.1",
4
+ "version": "7.4.3",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {