import { z } from "zod/v4"; import { toolEffectSchema } from "./effect"; /** * Tool metadata (plan §10.1) — the manifest artifact of a tool. * * `inputSchema` is JSON Schema, produced by the extraction step from the * tool's Zod input (`z.toJSONSchema`). The executable `execute()` never * appears here; it lives in the runtime artifact (plan §6.1). Result-card * hints are deliberately absent in Phase 0 — cards land with Phase 1 and * the field is additive. */ export const toolNameSchema = z .string() .trim() .regex( /^[a-z][a-z0-9-]*\.[a-z][a-z0-9_]*$/, "Tool names are `{appKey}.{tool_name}`, lowercase snake_case.", ) .max(160); export const appToolMetadataSchema = z.strictObject({ name: toolNameSchema, description: z.string().trim().min(1).max(1000), inputSchema: z.record(z.string(), z.unknown()), effect: toolEffectSchema, }); export type AppToolMetadata = z.infer;