N
Nyxis
Tools

ToolResult

Auto-formatted output viewer — JSON / text / markdown / image — with copy and truncate.

Preview

search_documents · json
{
  "hits": [
    {
      "id": "doc_1",
      "title": "Streaming chat architecture",
      "score": 0.94
    },
    {
      "id": "doc_2",
      "title": "Provider catalog",
      "score": 0.88
    }
  ],
  "total": 2
}

execute_code · error

ReferenceError: x is not defined at Object.<anonymous> (/sandbox/main.ts:12:7)

Installation

pnpm add nyxis-ui

Usage

import { ToolResult } from 'nyxis-ui';

<ToolResult result={tool.result} label={tool.name} />;
<ToolResult error="Sandbox unreachable" label="execute_code" />;

Auto-detection

Pass format="auto" (the default) and the component picks the right renderer:

Value shapeRenders as
Object / arrayPretty-printed JSON
data:image/... URL<img>
https://...png/jpg/... URL<img>
Anything elsePlain text

Pass format="markdown" to force markdown rendering, or format="json" to skip detection.

Errors

When error is set, the card switches to the destructive variant — the value is rendered in mono-space, no copy button, distinct border.