MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / ToolRunResult

Function ToolRunResult

packages/react/src/components/tool-run-panel.tsx:371–427  ·  view source on GitHub ↗
(props: { readonly result: RunResult })

Source from the content-addressed store, hash-verified

369}
370
371function ToolRunResult(props: { readonly result: RunResult }) {
372 const { result } = props;
373
374 if (result.kind === "paused") {
375 return (
376 <CardStack>
377 <CardStackHeader>Result</CardStackHeader>
378 <CardStackContent>
379 <p className="px-4 py-3 text-sm text-muted-foreground">
380 This tool requires approval (a policy gates it) — adjust the policy to run it directly.
381 </p>
382 </CardStackContent>
383 </CardStack>
384 );
385 }
386
387 const failed = result.isError || isFailedEnvelope(result.structured);
388 const hasStructured = result.structured !== undefined;
389
390 return (
391 <CardStack className={cn(failed ? "border-destructive/40" : undefined)}>
392 <CardStackHeader>
393 <div className="flex items-center gap-2">
394 <span>Result</span>
395 <Badge variant={failed ? "destructive" : "secondary"}>
396 {failed ? "Error" : "Success"}
397 </Badge>
398 </div>
399 </CardStackHeader>
400 <CardStackContent className="space-y-3 px-4 py-4">
401 {failed && (
402 <p className="text-xs text-destructive">
403 The tool returned an error — the credentials may be invalid or lack access.
404 </p>
405 )}
406 {hasStructured ? (
407 <CodeBlock
408 code={prettyJson(result.structured)}
409 lang="json"
410 title="Structured"
411 className={cn(failed ? "border-destructive/40" : undefined)}
412 />
413 ) : null}
414 {result.text && result.text.length > 0 && (
415 <div className="space-y-1">
416 <p className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
417 Text
418 </p>
419 <pre className="max-h-48 overflow-auto rounded-md border border-border bg-card/60 p-3 font-mono text-xs whitespace-pre-wrap break-words text-foreground/80">
420 {result.text}
421 </pre>
422 </div>
423 )}
424 </CardStackContent>
425 </CardStack>
426 );
427}

Callers

nothing calls this directly

Calls 3

cnFunction · 0.90
isFailedEnvelopeFunction · 0.85
prettyJsonFunction · 0.85

Tested by

no test coverage detected