Skip to main content
ai-tool-elements ships TypeScript declarations alongside its JavaScript output. All public types are re-exported from the main entry point (ai-tool-elements) — no separate @types/ package is needed. Consuming the library in a TypeScript project gives you full type safety on tool definitions, card props, and catalog entries.

Exported types

The following types are declared in src/types.ts and re-exported from the package root.

ToolField

A single configuration field on a tool, rendered as a row inside the card’s content area.

ToolImage

The logo for a tool — either inline SVG markup or a hosted URL. The card renders images through a standard <img> element, so SVG content must be complete and self-contained.

Tool

The core connector definition. Every catalog entry and application-defined connector satisfies this shape.

ToolCatalogItem

An alias for Tool. Used to annotate entries in the built-in catalog — semantically it signals that the object is part of the published catalog rather than a one-off application definition.

Using the Tool type

Define custom connectors with as const satisfies Tool to get the narrowest possible literal types while still being checked against the Tool shape. TypeScript will then enforce that all required fields are present and that extra fields do not violate the readonly constraint.
as const makes every string literal and nested property a narrow readonly type. satisfies Tool validates the shape at the point of definition without widening the type to Tool, so later code still benefits from the exact literal types.

ToolCard generics

ToolCard is generic over any subtype of Tool. If you define a connector type that adds fields beyond the base Tool shape, those extra properties remain accessible through the tool prop inside the component tree.
When you pass a plain Tool-shaped object, T defaults to Tool and no explicit type parameter is needed.

ToolCardProps

ToolCardProps is the full props type for the ToolCard component. It extends the underlying shadcn/ui Card props (minus children, which the card manages internally) and adds three ai-tool-elements-specific props.
All other props accepted by shadcn/ui’s Card component (such as style, aria-*, data-*) pass through unchanged.

Importing types

All types can be imported from the single package entry point. Use import type to ensure zero runtime overhead — the imports are erased entirely during compilation.
Use import type (instead of import) for type-only imports to ensure zero runtime overhead. TypeScript erases these imports entirely during compilation, so they never appear in the emitted JavaScript.