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
3 changed files with 87 additions and 6 deletions
|
|
@ -10,6 +10,7 @@
|
|||
{ "preset": "mrtr_sample" },
|
||||
{ "preset": "mrtr_roots" },
|
||||
{ "preset": "mrtr_edge" },
|
||||
{ "preset": "mrtr_empty" },
|
||||
{ "preset": "mrtr_loop" }
|
||||
],
|
||||
"transport": {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import {
|
|||
createMrtrSamplingTool,
|
||||
createMrtrLoopTool,
|
||||
createMrtrEdgeCaseTool,
|
||||
createMrtrEmptyResultTool,
|
||||
createCollectUrlElicitationTool,
|
||||
createUrlElicitationFormTool,
|
||||
createSendNotificationTool,
|
||||
|
|
@ -151,6 +152,8 @@ function resolveToolPreset(
|
|||
return createMrtrLoopTool();
|
||||
case "mrtr_edge":
|
||||
return createMrtrEdgeCaseTool();
|
||||
case "mrtr_empty":
|
||||
return createMrtrEmptyResultTool();
|
||||
case "collect_url_elicitation":
|
||||
return createCollectUrlElicitationTool();
|
||||
case "url_elicitation_form":
|
||||
|
|
|
|||
|
|
@ -755,6 +755,50 @@ export function createMrtrEdgeCaseTool(): ToolDefinition {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* An MRTR tool whose FINAL (complete) result carries an empty `content` array
|
||||
* and no `structuredContent` — a legal `CallToolResult` that renders nothing.
|
||||
*
|
||||
* This is the shape behind #1860: the sequence completes (the Protocol tab shows
|
||||
* the conversation COMPLETE), a real result is stored, and the Results panel had
|
||||
* no way to say so — it fell through to the same "No results yet" placeholder it
|
||||
* shows before anything has run, so a successful call read as a call that never
|
||||
* happened. Kept as an MRTR tool rather than a plain one because the multi-round
|
||||
* case is where the ambiguity actually misleads: the user has answered prompts
|
||||
* and watched rounds complete, so "no results yet" is flatly contradicted by
|
||||
* what they just did.
|
||||
*/
|
||||
export function createMrtrEmptyResultTool(): ToolDefinition {
|
||||
return {
|
||||
name: "mrtr_empty",
|
||||
description:
|
||||
"MRTR tool that completes with an empty result (no content, no structuredContent).",
|
||||
inputSchema: {},
|
||||
handler: async (
|
||||
_params: Record<string, unknown>,
|
||||
_context?: TestServerContext,
|
||||
extra?: HandlerExtra,
|
||||
) => {
|
||||
if (extra?.inputResponses?.ack === undefined) {
|
||||
return inputRequired({
|
||||
inputRequests: {
|
||||
ack: inputRequired.elicit({
|
||||
message: "Acknowledge to finish (the result will be empty)",
|
||||
requestedSchema: {
|
||||
type: "object",
|
||||
properties: { ack: { type: "boolean", title: "Acknowledge" } },
|
||||
required: ["ack"],
|
||||
},
|
||||
}),
|
||||
},
|
||||
requestState: `mrtr-empty:${++mrtrMintCount}`,
|
||||
});
|
||||
}
|
||||
return { content: [] } satisfies CallToolResult;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a "url_elicitation_form" tool that spins up a simple HTTP server on a dynamic
|
||||
* port with a form page, sends that URL via URL elicitation, and on form submit collects
|
||||
|
|
|
|||
Loading…
Reference in a new issue