fix(web): name an empty tool result instead of "No results yet" (#1860)
The Tools screen mounts the Results panel only once a call has produced a result, but the panel's zero-content branch rendered "No results yet" — the same wording it would use before anything had run. An empty `content` array with no `structuredContent` is a legal `CallToolResult`, so a call that had plainly completed reported itself as a call that never happened. That reads worst after a multi-round-trip (MRTR) sequence, which is how it was reported: the user answers one or more embedded elicitations, watches the Protocol tab group the exchange and mark it COMPLETE, and is then told there are no results yet. Nothing was lost — the result was stored and rendered; the panel simply had no wording for "completed, returned nothing". The panel now renders an "Empty result" alert saying the call completed and returned no content. This is the remaining half of the same gap #1908 closed for `structuredContent`-only results. test-servers: new `mrtr_empty` preset (`createMrtrEmptyResultTool`) — one elicitation round, then a complete result with `content: []` and no `structuredContent` — added to `mrtr-showcase-http.json` so the shape is reproducible by hand. README documents it. Signed-off-by: Cliff Hall <cliff@futurescale.com> Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
6bc355df63
commit
b3aedf62cd
2 changed files with 87 additions and 6 deletions
|
|
@ -35,11 +35,20 @@ describe("ToolResultPanel", () => {
|
|||
expect(screen.getByText("boom")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders the empty state when content is empty", () => {
|
||||
// #1860: this panel only mounts once a result exists, so an empty result must
|
||||
// read as "the call completed and returned nothing" — never as the pre-run
|
||||
// "No results yet" placeholder, which denies a call the user watched succeed.
|
||||
it("names the outcome when a completed result has no content", () => {
|
||||
renderWithMantine(
|
||||
<ToolResultPanel result={emptyResult} onClear={() => {}} />,
|
||||
);
|
||||
expect(screen.getByText("No results yet")).toBeInTheDocument();
|
||||
expect(screen.getByText("Empty result")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(
|
||||
"The tool call completed successfully and returned no content.",
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.queryByText("No results yet")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("groups resource_link blocks in a scrollable Resource Links box", async () => {
|
||||
|
|
@ -141,7 +150,7 @@ describe("ToolResultPanel", () => {
|
|||
onClear={() => {}}
|
||||
/>,
|
||||
);
|
||||
expect(screen.queryByText("No results yet")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Empty result")).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "Structured Output" }),
|
||||
).toBeInTheDocument();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import {
|
|||
Paper,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import type {
|
||||
|
|
@ -176,6 +175,16 @@ const ErrorAlert = Alert.withProps({
|
|||
title: "Tool Error",
|
||||
});
|
||||
|
||||
// A completed call whose result renders nothing. `content: []` with no
|
||||
// `structuredContent` is a legal CallToolResult, and this panel is only mounted
|
||||
// once a result exists — so saying "no results yet" here would deny a call the
|
||||
// user just watched succeed (#1860). Name the outcome instead.
|
||||
const EmptyResultAlert = Alert.withProps({
|
||||
color: "gray",
|
||||
variant: "light",
|
||||
title: "Empty result",
|
||||
});
|
||||
|
||||
function ResourceLinksGroup({
|
||||
links,
|
||||
onReadResource,
|
||||
|
|
@ -277,7 +286,9 @@ export function ToolResultPanel({
|
|||
</ResultScroll>
|
||||
) : result.content.length === 0 && !structuredNode ? (
|
||||
<ResultScroll>
|
||||
<Text c="dimmed">No results yet</Text>
|
||||
<EmptyResultAlert>
|
||||
The tool call completed successfully and returned no content.
|
||||
</EmptyResultAlert>
|
||||
</ResultScroll>
|
||||
) : hasLinks ? (
|
||||
<FillStack>
|
||||
|
|
|
|||
Loading…
Reference in a new issue