ngx-prompt-kit

Tool

Visualization for an agent tool-call. Four states (input-streaming, input-available, output-available, output-error), expandable body with the input args, output, error, and call ID.

Examples

Output available (success)

Most common steady state — the tool returned a result.

Input

city: Zurich
units: metric

Output

{
  "temp_c": 11.4,
  "condition": "Partly cloudy",
  "humidity": 78
}
Call ID: call_8c1e9a4f

Input streaming

The model is still composing the tool's arguments. Spinner icon, blue badge.

Input

query: angular signals best p
Processing tool call...
Call ID: call_2db77ed1

Input ready, awaiting execution

Args parsed, tool not yet invoked. Orange 'Ready' badge.

Input

path: ./src/app
recursive: true
Call ID: call_44a812bc

Output error

Tool returned an error. Red badge plus a dedicated Error section in the body.

Input

to: invalid@@example
subject: Hello

Error

SMTP rejected: 550 5.1.1 Recipient address invalid.
Call ID: call_e0987c44

Installation

Add the tool component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:tool

Component API

PkTool

PropTypeDefaultDescription
toolPartToolPartRequired. { type, state, input?, output?, toolCallId?, errorText? }
defaultOpenboolean false Initial expanded state.
classstringExtra classes for the wrapper.

ToolPart

PropTypeDefaultDescription
typestringTool name (e.g. "fetch_weather").
stateToolState"input-streaming" | "input-available" | "output-available" | "output-error"
inputRecord<string, unknown>Arguments. Pretty-printed in the Input section when present.
outputRecord<string, unknown>Result. JSON-stringified in the Output section.
errorTextstringError message (only shown for state=output-error).
toolCallIdstringCall ID, displayed at the bottom in monospace.