Surface isError in ToolResultPanel
Show a red alert banner when CallToolResult.isError is true, giving a visual distinction between successful and failed tool executions. Add ErrorResult story to demonstrate the error state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
16f4d9b50f
commit
79af8bc194
2 changed files with 20 additions and 1 deletions
|
|
@ -89,3 +89,17 @@ export const MixedContent: Story = {
|
|||
result: mixedResult,
|
||||
},
|
||||
};
|
||||
|
||||
export const ErrorResult: Story = {
|
||||
args: {
|
||||
result: {
|
||||
isError: true,
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "ENOENT: no such file or directory, open '/data/missing.txt'",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Button, Group, Stack, Text, Title } from "@mantine/core";
|
||||
import { Alert, Button, Group, Stack, Text, Title } from "@mantine/core";
|
||||
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { ContentViewer } from "../../elements/ContentViewer/ContentViewer";
|
||||
|
||||
|
|
@ -19,6 +19,11 @@ export function ToolResultPanel({ result, onClear }: ToolResultPanelProps) {
|
|||
<Title order={4}>Results</Title>
|
||||
<ClearButton onClick={onClear}>Clear</ClearButton>
|
||||
</Group>
|
||||
{result.isError && (
|
||||
<Alert color="red" variant="light">
|
||||
Tool execution returned an error
|
||||
</Alert>
|
||||
)}
|
||||
{result.content.length === 0 ? (
|
||||
<Text c="dimmed">No results yet</Text>
|
||||
) : (
|
||||
|
|
|
|||
Loading…
Reference in a new issue