/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 03d25d0a5e59 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ToolParameter, ToolParameter$inboundSchema } from "./toolparameter.js"; /** * Type of tool (READ, WRITE) */ export const ToolType = { Read: "READ", Write: "WRITE", } as const; /** * Type of tool (READ, WRITE) */ export type ToolType = OpenEnum; export type Tool = { /** * Type of tool (READ, WRITE) */ type?: ToolType | undefined; /** * Unique identifier for the tool */ name?: string | undefined; /** * Human-readable name */ displayName?: string | undefined; /** * LLM friendly description of the tool */ description?: string | undefined; /** * The parameters for the tool. Each key is the name of the parameter and the value is the parameter object. */ parameters?: { [k: string]: ToolParameter } | undefined; }; /** @internal */ export const ToolType$inboundSchema: z.ZodType< ToolType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(ToolType); /** @internal */ export const Tool$inboundSchema: z.ZodType = z .object({ type: ToolType$inboundSchema.optional(), name: z.string().optional(), displayName: z.string().optional(), description: z.string().optional(), parameters: z.record(ToolParameter$inboundSchema).optional(), }); export function toolFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Tool$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Tool' from JSON`, ); }