defineTool

defineTool

Types the props of a <Tool> outside JSX. It returns what you pass.

import { defineTool } from "curb";

function defineTool(config: ToolProps): ToolProps;

Example

const openClaim = defineTool({
  name: "open_claim",
  description: "Open a claim.",
  schema: z.object({ policy: z.string() }),
  onSubmit: async ({ policy }) => ({ ok: true, message: `Opened for ${policy}.` }),
});

<Tool {...openClaim} />

Version history

VersionChanges
v0.1.2defineTool introduced