Custom WidgetsRead-only

Generate custom widget

generate_custom_widget

ESCAPE HATCH — use this ONLY when a native widget spec (propose_insight_widget / author_widget) genuinely cannot express the UI; a validated native kind is always preferred (it renders in-process, no sandbox cost). When you do generate: write a React component in TS/JSX. Style with TAILWIND utility classes (just `className="..."` — the runtime JITs them, no config) and shadcn/ui-style components built on the vendored Radix primitives. Import ONLY: `@banksync/widget-sdk` (defineWidget, useData, useDataset, useSettings, useSetting, useFilters, useTheme, brokerFetch, emitFilter, openUrl), React, `recharts` (charts), `lucide-react` (icons), and the vendored libs (clsx, tailwind-merge, class-variance-authority, @radix-ui/react-*, d3-*, date-fns, zod). DESIGN — the widget must look BEAUTIFUL and FILL its dashboard tile (the user sizes the cell; the widget fills it responsively, like a chart). Give the ROOT `className="flex h-full flex-col gap-4 p-5 ..."`. Use the THEME-AWARE shadcn semantic colors (bg-card, text-card-foreground, text-muted-foreground, border, bg-primary/10, text-primary) so it adapts to light/dark automatically — avoid hard-coded black/white; give it a clear header (an icon in a rounded bg-primary/10 tile + a title), generous padding/gap, and rounded corners. For charts use recharts in a `<ResponsiveContainer width="100%" height="100%">` inside a `min-h-0 flex-1` box so the chart GROWS to fill; prefer a donut (innerRadius) with the total centered in the hole, rounded slices, and a legend with values + %. NO network (fetch), storage (localStorage), or frame access — those are rejected with correctable, line-anchored errors (fix and retry, max 2). Read the widget-SDK docs (search_docs) for the API + examples. Supply a complete portable manifest declaring every named input, widget-local field, setting, capability, and allowed network origin. Use `useDataset(inputId)` for data and `useSettings()`/`useSetting()` for configuration; `useData()` is legacy-v1 only. The source is compiled to a hash-pinned sandboxed build and returned as an INERT package proposal — safe to call speculatively. It does not create an installation, choose a bank/feed, or grant access; the user continues through the normal configure and approval flow.

Parameters

ParameterTypeRequiredDescription
sourcestringrequiredInput for source.
manifestobjectrequiredInput for manifest.
bundleIdstringoptionalInput for bundleId.

Example call

The tool call an MCP client sends (required arguments shown with placeholder values).

{
"tool": "generate_custom_widget",
"arguments": {
"source": "value",
"manifest": "value"
}
}

Use this tool in