/* * 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 approval request item: A request to approve or deny execution of an MCP tool call. */ export type MCPApprovalRequestWithId = { type: "mcp_approval_request"; /** * The unique ID of the message. */ id: string; arguments: string; name: string; serverLabel: string; /** * The ID of the response that created this item, if any. */ responseId?: string | null | undefined; /** * Metadata from the response that created this item, if any. */ metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const MCPApprovalRequestWithId$inboundSchema: z.ZodType< MCPApprovalRequestWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("mcp_approval_request"), id: z.string(), arguments: z.string(), name: z.string(), server_label: z.string(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "server_label": "serverLabel", "response_id": "responseId", }); }); /** @internal */ export type MCPApprovalRequestWithId$Outbound = { type: "mcp_approval_request"; id: string; arguments: string; name: string; server_label: string; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const MCPApprovalRequestWithId$outboundSchema: z.ZodType< MCPApprovalRequestWithId$Outbound, z.ZodTypeDef, MCPApprovalRequestWithId > = z.object({ type: z.literal("mcp_approval_request"), id: z.string(), arguments: z.string(), name: z.string(), serverLabel: z.string(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { serverLabel: "server_label", responseId: "response_id", }); }); export function mcpApprovalRequestWithIdToJSON( mcpApprovalRequestWithId: MCPApprovalRequestWithId, ): string { return JSON.stringify( MCPApprovalRequestWithId$outboundSchema.parse(mcpApprovalRequestWithId), ); } export function mcpApprovalRequestWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MCPApprovalRequestWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MCPApprovalRequestWithId' from JSON`, ); }