/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * MCP tool choice: Forces an MCP server, optionally narrowed to a specific MCP tool name. */ export type MCPToolChoice = { type: "mcp"; serverLabel: string; name?: string | undefined; }; /** @internal */ export const MCPToolChoice$inboundSchema: z.ZodType< MCPToolChoice, z.ZodTypeDef, unknown > = z.object({ type: z.literal("mcp"), server_label: z.string(), name: z.string().optional(), }).transform((v) => { return remap$(v, { "server_label": "serverLabel", }); }); /** @internal */ export type MCPToolChoice$Outbound = { type: "mcp"; server_label: string; name?: string | undefined; }; /** @internal */ export const MCPToolChoice$outboundSchema: z.ZodType< MCPToolChoice$Outbound, z.ZodTypeDef, MCPToolChoice > = z.object({ type: z.literal("mcp"), serverLabel: z.string(), name: z.string().optional(), }).transform((v) => { return remap$(v, { serverLabel: "server_label", }); }); export function mcpToolChoiceToJSON(mcpToolChoice: MCPToolChoice): string { return JSON.stringify(MCPToolChoice$outboundSchema.parse(mcpToolChoice)); } export function mcpToolChoiceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MCPToolChoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MCPToolChoice' from JSON`, ); }