import React, { useState } from "react"; import { useRenderTool } from "./use-render-tool"; type DefaultRenderProps = { /** The name of the tool being called. */ name: string; /** The parsed parameters passed to the tool call. */ parameters: unknown; /** Current execution status of the tool call. */ status: "inProgress" | "executing" | "complete"; /** The tool call result string, available only when `status` is `"complete"`. */ result: string | undefined; }; /** * Registers a wildcard (`"*"`) tool-call renderer via `useRenderTool`. * * - Call with no config to use CopilotKit's built-in default tool-call card. * - Pass `config.render` to replace the default UI with your own fallback renderer. * * This is useful when you want a generic renderer for tools that do not have a * dedicated `useRenderTool({ name: "..." })` registration. * * @param config - Optional custom wildcard render function. * @param deps - Optional dependencies to refresh registration. * * @example * ```tsx * useDefaultRenderTool(); * ``` * * @example * ```tsx * useDefaultRenderTool({ * render: ({ name, status }) =>
{JSON.stringify(parameters ?? {}, null, 2)}
{typeof result === "string"
? result
: JSON.stringify(result, null, 2)}