Skip to content

Commit f65e955

Browse files
Merge remote-tracking branch 'origin/main' into pr135-ci-fix
2 parents 5337205 + a51554a commit f65e955

9 files changed

Lines changed: 805 additions & 54 deletions

File tree

‎apps/web/src/components/ChatView.browser.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ it("an interrupted image-only first send of a new thread says it may not have be
284284
.element()
285285
.dispatchEvent(new ClipboardEvent("paste", { clipboardData, bubbles: true, cancelable: true }));
286286
await expect.element(page.getByRole("img", { name: "shot.png" })).toBeVisible();
287+
// The thumbnail is visible while compression still blocks sending.
288+
await expect.element(page.getByRole("button", { name: "Preview shot.png" })).toBeEnabled();
287289
await userEvent.keyboard("{Enter}");
288290
await vi.waitFor(() => expect(launch.calls).toHaveLength(1));
289291
await userEvent.keyboard("next draft");

‎packages/client-runtime/src/work-log/itemDetail.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,27 @@ describe("MCP app tool output", () => {
182182
expect(turnItemOutputText(bounded)).toBe("chart\n[image]");
183183
});
184184
});
185+
186+
describe("MCP results with the SDK's _meta", () => {
187+
const meta = { "io.modelcontextprotocol/serverInfo": { name: "T3 Code", version: "1" } };
188+
const structuredContent = {
189+
check: "Server tests 7",
190+
message: "expected [ 60 ]\nto equal [ 59 ]",
191+
};
192+
it.each([
193+
[
194+
"text and structured content",
195+
{ content: JSON.stringify(structuredContent), structuredContent },
196+
],
197+
["text blocks only", { content: [{ type: "text", text: "Server tests: 7 passed" }] }],
198+
[
199+
"text blocks and structured content",
200+
{ content: [{ type: "text", text: JSON.stringify(structuredContent) }], structuredContent },
201+
],
202+
])("reads %s the same with or without _meta", (_shape, result) => {
203+
const plain = turnItemOutputText(toolItem(result));
204+
const withMeta = turnItemOutputText(toolItem({ ...result, _meta: meta }));
205+
expect(withMeta).toBe(plain);
206+
expect(withMeta).not.toContain("serverInfo");
207+
});
208+
});

‎packages/client-runtime/src/work-log/itemDetail.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ function textFromBlocks(
4040
if (typeof resource.text === "string") return resource.text;
4141
if (typeof resource.uri === "string") return resource.uri;
4242
}
43-
const keys = Object.keys(value).filter((key) => key !== "isError" && key !== "is_error");
43+
// MCP SDKs stamp `_meta` with server info on every result; it is never the tool's output.
44+
const keys = Object.keys(value).filter(
45+
(key) => key !== "isError" && key !== "is_error" && key !== "_meta",
46+
);
4447
if (keys.length === 1 && keys[0] === "content")
4548
return textFromBlocks(value.content, depth + 1, imageBlocks);
4649
if (keys.length === 2 && keys.includes("content") && keys.includes("structuredContent")) {

0 commit comments

Comments
 (0)