/* * 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"; import { MCPTool, MCPTool$inboundSchema, MCPTool$Outbound, MCPTool$outboundSchema, } from "./mcptool.js"; /** * MCP list tools item: Result of discovering available tools from an MCP server. */ export type MCPListToolsWithId = { type: "mcp_list_tools"; /** * The unique ID of the message. */ id: string; serverLabel: string; tools: Array; error?: 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 MCPListToolsWithId$inboundSchema: z.ZodType< MCPListToolsWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("mcp_list_tools"), id: z.string(), server_label: z.string(), tools: z.array(MCPTool$inboundSchema), error: z.string().optional(), 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 MCPListToolsWithId$Outbound = { type: "mcp_list_tools"; id: string; server_label: string; tools: Array; error?: string | undefined; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const MCPListToolsWithId$outboundSchema: z.ZodType< MCPListToolsWithId$Outbound, z.ZodTypeDef, MCPListToolsWithId > = z.object({ type: z.literal("mcp_list_tools"), id: z.string(), serverLabel: z.string(), tools: z.array(MCPTool$outboundSchema), error: z.string().optional(), 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 mcpListToolsWithIdToJSON( mcpListToolsWithId: MCPListToolsWithId, ): string { return JSON.stringify( MCPListToolsWithId$outboundSchema.parse(mcpListToolsWithId), ); } export function mcpListToolsWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MCPListToolsWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MCPListToolsWithId' from JSON`, ); }