/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomToolFormat, CustomToolFormat$inboundSchema, CustomToolFormat$Outbound, CustomToolFormat$outboundSchema, } from "./customtoolformat.js"; /** * Custom tool definition: Defines a custom tool by name, with optional description and optional output format constraints. */ export type CustomToolDefinition = { type: "custom"; name: string; description?: string | undefined; format?: CustomToolFormat | undefined; }; /** @internal */ export const CustomToolDefinition$inboundSchema: z.ZodType< CustomToolDefinition, z.ZodTypeDef, unknown > = z.object({ type: z.literal("custom"), name: z.string(), description: z.string().optional(), format: CustomToolFormat$inboundSchema.optional(), }); /** @internal */ export type CustomToolDefinition$Outbound = { type: "custom"; name: string; description?: string | undefined; format?: CustomToolFormat$Outbound | undefined; }; /** @internal */ export const CustomToolDefinition$outboundSchema: z.ZodType< CustomToolDefinition$Outbound, z.ZodTypeDef, CustomToolDefinition > = z.object({ type: z.literal("custom"), name: z.string(), description: z.string().optional(), format: CustomToolFormat$outboundSchema.optional(), }); export function customToolDefinitionToJSON( customToolDefinition: CustomToolDefinition, ): string { return JSON.stringify( CustomToolDefinition$outboundSchema.parse(customToolDefinition), ); } export function customToolDefinitionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomToolDefinition$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomToolDefinition' from JSON`, ); }