About
Asks before an agent runs a tool. Shows what the call will do, offers Allow once, Always allow and Deny, and leaves a one-line record of the answer.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Tool Approval to your project and fits it to your theme.
Code
How Tool Approval is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client"
import * as React from "react"
import {
ToolApproval,
type ToolApprovalDecision,
} from "@/components/ui/mischief-tool-approval"
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
const readInput = { path: "src/app/settings/page.tsx", lines: "1-120" }
const deleteInput = { branch: "release/0.7", remote: "origin", force: false }
export default function ToolApprovalDemo() {
const [read, setRead] = React.useState<ToolApprovalDecision | null>(null)
const [removal, setRemoval] = React.useState<ToolApprovalDecision | null>(
null
)
return (
<div className="grid w-full max-w-md gap-3">
<p className="text-muted-foreground text-sm">
The agent is cleaning up after the 0.8 release.
</p>
<ToolApproval
input={readInput}
name="read_file"
onDecision={async (decision) => {
await wait(500)
setRead(decision)
}}
/>
<ToolApproval
destructive
input={deleteInput}
name="delete_branch"
summary={
<p>
Deletes <code>release/0.7</code> on origin. Anyone who has not
pulled it loses the branch.
</p>
}
onDecision={async (decision) => {
await wait(500)
setRemoval(decision)
}}
/>
</div>
)
}















