/* * 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 response item: The decision payload for a prior MCP approval request. */ export type MCPApprovalResponseWithId = { type: "mcp_approval_response"; approvalRequestId: string; approve: boolean; /** * The unique ID of the message. */ id: string; reason?: string | undefined; /** * 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 MCPApprovalResponseWithId$inboundSchema: z.ZodType< MCPApprovalResponseWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("mcp_approval_response"), approval_request_id: z.string(), approve: z.boolean(), id: z.string(), reason: z.string().optional(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "approval_request_id": "approvalRequestId", "response_id": "responseId", }); }); /** @internal */ export type MCPApprovalResponseWithId$Outbound = { type: "mcp_approval_response"; approval_request_id: string; approve: boolean; id: string; reason?: string | undefined; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const MCPApprovalResponseWithId$outboundSchema: z.ZodType< MCPApprovalResponseWithId$Outbound, z.ZodTypeDef, MCPApprovalResponseWithId > = z.object({ type: z.literal("mcp_approval_response"), approvalRequestId: z.string(), approve: z.boolean(), id: z.string(), reason: z.string().optional(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { approvalRequestId: "approval_request_id", responseId: "response_id", }); }); export function mcpApprovalResponseWithIdToJSON( mcpApprovalResponseWithId: MCPApprovalResponseWithId, ): string { return JSON.stringify( MCPApprovalResponseWithId$outboundSchema.parse(mcpApprovalResponseWithId), ); } export function mcpApprovalResponseWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MCPApprovalResponseWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MCPApprovalResponseWithId' from JSON`, ); }