AgentSkillsCN

tools-ui

由 ui.inference.sh 提供的 React/Next.js 工具生命周期UI组件。可实时展示工具调用状态:待处理、进行中、需审批、已出结果。功能涵盖:工具状态、进度指示、审批流程、结果展示。适用场景:展示智能体工具调用、人机协作审批、工具输出结果。触发关键词:工具UI、工具调用、工具状态、工具审批、工具结果、“智能体工具、MCP工具UI、函数调用UI、工具生命周期、工具待处理”。

SKILL.md
--- frontmatter
name: tools-ui
description: "Tool lifecycle UI components for React/Next.js from ui.inference.sh. Display tool calls: pending, progress, approval required, results. Capabilities: tool status, progress indicators, approval flows, results display. Use for: showing agent tool calls, human-in-the-loop approvals, tool output. Triggers: tool ui, tool calls, tool status, tool approval, tool results,"  agent tools, mcp tools ui, function calling ui, tool lifecycle, tool pending

Tool UI Components

Tool lifecycle components from ui.inference.sh.

Tool UI Components

Quick Start

bash
npx shadcn@latest add https://ui.inference.sh/r/tools.json

Tool States

StateDescription
pendingTool call requested, waiting to execute
runningTool is currently executing
approvalRequires human approval before execution
successTool completed successfully
errorTool execution failed

Components

Tool Call Display

tsx
import { ToolCall } from "@/registry/blocks/tools/tool-call"

<ToolCall
  name="search_web"
  args={{ query: "latest AI news" }}
  status="running"
/>

Tool Result

tsx
import { ToolResult } from "@/registry/blocks/tools/tool-result"

<ToolResult
  name="search_web"
  result={{ results: [...] }}
  status="success"
/>

Tool Approval

tsx
import { ToolApproval } from "@/registry/blocks/tools/tool-approval"

<ToolApproval
  name="send_email"
  args={{ to: "user@example.com", subject: "Hello" }}
  onApprove={() => executeTool()}
  onDeny={() => cancelTool()}
/>

Full Example

tsx
import { ToolCall, ToolResult, ToolApproval } from "@/registry/blocks/tools"

function ToolDisplay({ tool }) {
  if (tool.status === 'approval') {
    return (
      <ToolApproval
        name={tool.name}
        args={tool.args}
        onApprove={tool.approve}
        onDeny={tool.deny}
      />
    )
  }

  if (tool.result) {
    return (
      <ToolResult
        name={tool.name}
        result={tool.result}
        status={tool.status}
      />
    )
  }

  return (
    <ToolCall
      name={tool.name}
      args={tool.args}
      status={tool.status}
    />
  )
}

Styling Tool Cards

tsx
<ToolCall
  name="read_file"
  args={{ path: "/src/index.ts" }}
  status="running"
  className="border-blue-500"
/>

Tool Icons

Tools automatically get icons based on their name:

PatternIcon
search*, find*Search
read*, get*File
write*, create*Pencil
delete*, remove*Trash
send*, email*Mail
DefaultWrench

With Agent Component

The Agent component handles tool lifecycle automatically:

tsx
import { Agent } from "@/registry/blocks/agent/agent"

<Agent
  proxyUrl="/api/inference/proxy"
  config={{
    core_app: { ref: 'openrouter/claude-sonnet-45@0fkg6xwb' },
    tools: [
      {
        name: 'search_web',
        description: 'Search the web',
        parameters: { query: { type: 'string' } },
        requiresApproval: true, // Enable approval flow
      },
    ],
  }}
/>

Related Skills

bash
# Full agent component (recommended)
npx skills add inferencesh/skills@agent-ui

# Chat UI blocks
npx skills add inferencesh/skills@chat-ui

# Widgets for tool results
npx skills add inferencesh/skills@widgets-ui

Documentation

Component docs: ui.inference.sh/blocks/tools