@runbit/tool
v0.1.1
Published
First-class, typed tools with clear validation errors.
Readme
@runbit/tool
First-class, typed tools with clear validation errors.
npm install @runbit/toolimport { tool } from "@runbit/tool";
import { z } from "zod"; // any schema with .parse works — zod is optional
const weather = tool({
name: "weather",
description: "Get the weather for a city.",
parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
input: z.object({ city: z.string() }),
run: ({ city }) => `sunny in ${city}`,
});parametersis the JSON schema a model uses to call the tool.inputis any object with aparse(zod-compatible) — invalid input throws aRunbitErrornaming the tool.createToolRegistry(tools, getContext)runs tools and emitstool:start/tool:end/tool:error.
Part of Runbit — the AI Runtime. Everything executes through one small, event-driven runtime; agents, workflows, RAG, and observability are packages on top.
- Umbrella:
@runbit/runtime - License: MIT
