@agentvalet/mcp-server 0.3.4 → 0.3.5
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.
- package/dist/index.js +17 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -471,13 +471,27 @@ async function waitForApproval(approvalId, originalCall, progressToken) {
|
|
|
471
471
|
// Re-execution complete. Return the upstream response transparently —
|
|
472
472
|
// the agent sees this as if the original use_platform call just succeeded.
|
|
473
473
|
const r = status.result;
|
|
474
|
-
const summary = `[Owner approved after ${Math.round(elapsed / 1000)}s]\n` +
|
|
475
|
-
JSON.stringify(r.data ?? null);
|
|
476
474
|
// Mirror the non-2xx-from-upstream behaviour of the regular path.
|
|
477
475
|
if (r.status < 200 || r.status >= 300) {
|
|
478
476
|
return errorContent(`Upstream returned ${r.status}: ${JSON.stringify(r.data)}`);
|
|
479
477
|
}
|
|
480
|
-
|
|
478
|
+
// Two-channel return: the text envelope carries the human-readable
|
|
479
|
+
// "[Owner approved after Ns]" prefix (visible to non-structured-aware
|
|
480
|
+
// clients), and structuredContent carries the parsed upstream JSON
|
|
481
|
+
// directly so MCP-aware hosts (Claude Desktop ≥ MCP spec 2025-06-18)
|
|
482
|
+
// never have to strip-the-prefix-and-reparse. Without the second
|
|
483
|
+
// channel the prefix forces Claude into the same wrapper-parse
|
|
484
|
+
// round-trip the bare /v1/actions path used to.
|
|
485
|
+
const data = r.data ?? null;
|
|
486
|
+
const summary = `[Owner approved after ${Math.round(elapsed / 1000)}s]\n` +
|
|
487
|
+
JSON.stringify(data);
|
|
488
|
+
const result = {
|
|
489
|
+
content: [{ type: "text", text: summary }],
|
|
490
|
+
};
|
|
491
|
+
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
492
|
+
result.structuredContent = data;
|
|
493
|
+
}
|
|
494
|
+
return result;
|
|
481
495
|
}
|
|
482
496
|
if (status.status === "denied") {
|
|
483
497
|
return errorContent(`Owner denied this action${status.execution_error ? `: ${status.execution_error}` : "."}`);
|