Hidden Tools & Fallback Renderer

Run tools silently without showing them in the chat UI, and catch-all renderers for unregistered tools

Beta — This feature is in alpha. APIs may change before stable release.


Hidden Tools

Register tools that execute silently — they run when called by the AI but are never shown in the tool execution UI.

import { useTool } from "@yourgpt/copilot-sdk/react";

useTool({
  name: "log_analytics_event",
  description: "Log a UI analytics event",
  hidden: true,   // Never rendered in chat UI
  inputSchema: z.object({ event: z.string(), data: z.record(z.unknown()) }),
  handler: async ({ event, data }) => {
    analytics.track(event, data);
    return {};
  },
});

Use hidden tools for:

  • Analytics and logging
  • Background state updates
  • Internal bookkeeping the user doesn't need to see

Fallback Tool Renderer

The <CopilotChat> component resolves a renderer for each tool execution using this priority chain:

PrioritySourceDescription
1toolRenderers[toolName]Per-tool renderer map on <CopilotChat>
2tool.renderRender function on the ToolDefinition
3mcpToolRendererCatch-all for tools with source: "mcp"
4fallbackToolRendererCatch-all for any unmatched tool
5Built-in defaultGeneric tool execution card
<CopilotChat
  // Highest priority — per-tool
  toolRenderers={{
    get_weather: ({ args, result }) => <WeatherCard {...result} />,
  }}
  // MCP catch-all
  mcpToolRenderer={({ toolName, args, result }) => (
    <MCPCard name={toolName} />
  )}
  // Universal catch-all
  fallbackToolRenderer={({ toolName, args, result }) => (
    <pre>{JSON.stringify(result, null, 2)}</pre>
  )}
/>

The fallbackToolRenderer is useful when you have dynamically registered tools or MCP tools whose names you don't know at render time.

On this page