/* * 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 MCPToolCall = { type: "mcp_call"; id: string; approvalRequestId?: string | null | undefined; arguments: string; name: string; serverLabel: string; error?: string | undefined; output?: string | undefined; }; /** @internal */ export const MCPToolCall$inboundSchema: z.ZodType< MCPToolCall, 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(), }).transform((v) => { return remap$(v, { "approval_request_id": "approvalRequestId", "server_label": "serverLabel", }); }); /** @internal */ export type MCPToolCall$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; }; /** @internal */ export const MCPToolCall$outboundSchema: z.ZodType< MCPToolCall$Outbound, z.ZodTypeDef, MCPToolCall > = 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(), }).transform((v) => { return remap$(v, { approvalRequestId: "approval_request_id", serverLabel: "server_label", }); }); export function mcpToolCallToJSON(mcpToolCall: MCPToolCall): string { return JSON.stringify(MCPToolCall$outboundSchema.parse(mcpToolCall)); } export function mcpToolCallFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MCPToolCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MCPToolCall' from JSON`, ); }