/* * 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 call item: A direct call record for an MCP tool, including request arguments and optional output/error. */ export type MCPToolCallWithId = { type: "mcp_call"; /** * The unique ID of the message. */ id: string; approvalRequestId?: string | null | undefined; arguments: string; name: string; serverLabel: string; error?: string | undefined; output?: 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 MCPToolCallWithId$inboundSchema: z.ZodType< MCPToolCallWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("mcp_call"), id: z.string(), approval_request_id: z.nullable(z.string()).optional(), arguments: z.string(), name: z.string(), server_label: z.string(), error: z.string().optional(), output: 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", "server_label": "serverLabel", "response_id": "responseId", }); }); /** @internal */ export type MCPToolCallWithId$Outbound = { type: "mcp_call"; id: string; approval_request_id?: string | null | undefined; arguments: string; name: string; server_label: string; error?: string | undefined; output?: string | undefined; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const MCPToolCallWithId$outboundSchema: z.ZodType< MCPToolCallWithId$Outbound, z.ZodTypeDef, MCPToolCallWithId > = z.object({ type: z.literal("mcp_call"), id: z.string(), approvalRequestId: z.nullable(z.string()).optional(), arguments: z.string(), name: z.string(), serverLabel: z.string(), error: z.string().optional(), output: 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", serverLabel: "server_label", responseId: "response_id", }); }); export function mcpToolCallWithIdToJSON( mcpToolCallWithId: MCPToolCallWithId, ): string { return JSON.stringify( MCPToolCallWithId$outboundSchema.parse(mcpToolCallWithId), ); } export function mcpToolCallWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MCPToolCallWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MCPToolCallWithId' from JSON`, ); }