PXD
v0.2.1-dev

Tool Call

Collapsible card for tool / function call traces with input and output payloads.

Default

search_flights
Input
{
  "origin": "LHR",
  "destination": "SFO",
  "date": "2026-06-14",
  "cabin": "economy"
}
Output
{
  "route": "LHR -> SFO",
  "bestOption": {
    "airline": "BA",
    "priceUsd": 742,
    "duration": "10h 45m",
    "stops": 0
  }
}
<template>
  <PToolCall
    title="search_flights"
    status="completed"
    :input="{
      origin: 'LHR',
      destination: 'SFO',
      date: '2026-06-14',
      cabin: 'economy',
    }"
    :output="{
      route: 'LHR -> SFO',
      bestOption: {
        airline: 'BA',
        priceUsd: 742,
        duration: '10h 45m',
        stops: 0,
      },
    }"
  />
</template>

Simple

variant="simple" drops the card background, border and trigger padding, so the call sits inline like PReasoning.

search_flights
Input
{
  "origin": "LHR",
  "destination": "SFO"
}
Output
{
  "route": "LHR -> SFO",
  "priceUsd": 742
}
<template>
  <PToolCall
    variant="simple"
    title="search_flights"
    status="completed"
    :input="{ origin: 'LHR', destination: 'SFO' }"
    :output="{ route: 'LHR -> SFO', priceUsd: 742 }"
  />
</template>

Text Output

Tool results are not always JSON. Plain strings render as-is, and content-block arrays (pi agent sdk / Anthropic style content: [{ type: 'text', text }]) are unwrapped to their text, with image blocks shown as [image] placeholders.

bash
Input
{
  "command": "pnpm test",
  "timeout": 30000
}
Output
$ pnpm test
 ✓ 8 tests passed
 Done in 2.14s
bash
Input
{
  "command": "pnpm build"
}
Output
pnpm: command not found
Command exited with code 127
<template>
  <PStack direction="vertical" class="gap-3">
    <PToolCall
      title="bash"
      status="completed"
      :input="{ command: 'pnpm test', timeout: 30000 }"
      :output="[{ type: 'text', text: '$ pnpm test\n ✓ 8 tests passed\n Done in 2.14s' }]"
    />
    <PToolCall
      title="bash"
      status="error"
      :input="{ command: 'pnpm build' }"
      :output="'pnpm: command not found\nCommand exited with code 127'"
    />
  </PStack>
</template>

Status

lookup_weather
Input
{
  "city": "San Francisco"
}
lookup_weather
Input
{
  "city": "San Francisco"
}
lookup_weather
Input
{
  "city": "San Francisco"
}
Output
{
  "tempC": 18,
  "condition": "fog"
}
lookup_weather
Input
{
  "city": "San Francisco"
}
Output
{
  "message": "Upstream timeout"
}
<template>
  <PStack direction="vertical" class="gap-3">
    <PToolCall title="lookup_weather" status="pending" :input="{ city: 'San Francisco' }" />
    <PToolCall title="lookup_weather" status="running" :input="{ city: 'San Francisco' }" />
    <PToolCall
      title="lookup_weather"
      status="completed"
      :input="{ city: 'San Francisco' }"
      :output="{ tempC: 18, condition: 'fog' }"
    />
    <PToolCall
      title="lookup_weather"
      status="error"
      :input="{ city: 'San Francisco' }"
      :output="{ message: 'Upstream timeout' }"
    />
  </PStack>
</template>

Props

NameTypeDefaultDescription
titlestring-Tool name shown in the header
variant'default' | 'simple'defaultsimple drops the card background, border and trigger padding
status'pending' | 'running' | 'completed' | 'error'pendingStatus icon in the header
expandbooleantrueExpanded state, applied whenever the value changes
inputunknown-Request payload (objects and JSON strings are pretty-printed as JSON, content-block arrays as plain text)
outputunknown-Response payload (objects and JSON strings are pretty-printed as JSON, content-block arrays as plain text)

Slots

NameDescription
inputReplaces the input code block; renders even when input is empty
outputReplaces the output code block; renders even when output is empty

Source

Source