---
title: "Tool view"
description: "tool-view thay thế hoặc bổ sung cách hiển thị tool call do cùng app khai báo. Gắn nó bằng toolNames không rỗng. Core truyền đúng một prop toolResult và giữ nguyên mount khi stat…"
url: "https://sotaagents.ai/vi/manual/developer-guide/tool-views"
generated_by: "sotaagents-ldp"
docs_index: "https://sotaagents.ai/manual/llms.txt"
locale: "vi"
---

# Tool view

`tool-view` thay thế hoặc bổ sung cách hiển thị tool call do cùng app khai báo. Gắn nó bằng `toolNames` không rỗng. Core truyền đúng một prop `toolResult` và giữ nguyên mount khi state thay đổi.

YAML

```
contributes:
  ui:
    - id: calendar-result
      kind: nativeModule
      surface: tool-view
      slot: chat.message.inline.below
      toolNames: [readCalendar]
      renderBeforeOutput: true
      module:
        entry: dist/ui/app.js
        export: CalendarResult
```

TSX

```
import type { ToolResultSurfaceProps } from '@sota/platform';

type Input = { from: string; to: string };
type Output = { events: Array<{ id: string; title: string }> };

export function CalendarResult({ toolResult }: ToolResultSurfaceProps<Input, Output>) {
  if (toolResult.state === 'input-streaming') return <p>Preparing…</p>;
  if (toolResult.state === 'output-pending') return <p>Waiting for an action…</p>;
  if (toolResult.state === 'output-error') return <p>{toolResult.errorText}</p>;
  if (toolResult.state === 'output-denied') return <p>Permission denied.</p>;
  if (toolResult.state !== 'output-available') return <p>Running…</p>;
  return <p>{toolResult.result?.events.length ?? 0} events</p>;
}
```

| State | Contract |
| --- | --- |
| `input-streaming` | Partial input dạng `unknown`; chỉ có khi bật `renderBeforeOutput`. |
| `input-available`, approval states | Input hoàn chỉnh đã validate schema. |
| `output-pending` | Tool call đang deferred; có thể có `deferred.operationId` và `data` opaque của app. |
| `output-available` | `result` là app result đã bỏ metadata transport; `output` giữ raw host value. |
| `output-error`, `output-denied` | Không được giả định có result. |

`execution` chỉ app lane đã tạo tool call. Đây là context chẩn đoán cho payload, không phải yêu cầu load historical artifact của producer.
