/* * 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 MCPListTools = { type: "mcp_list_tools"; id: string; serverLabel: string; tools: Array; error?: string | undefined; }; /** @internal */ export const MCPListTools$inboundSchema: z.ZodType< MCPListTools, 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(), }).transform((v) => { return remap$(v, { "server_label": "serverLabel", }); }); /** @internal */ export type MCPListTools$Outbound = { type: "mcp_list_tools"; id: string; server_label: string; tools: Array; error?: string | undefined; }; /** @internal */ export const MCPListTools$outboundSchema: z.ZodType< MCPListTools$Outbound, z.ZodTypeDef, MCPListTools > = z.object({ type: z.literal("mcp_list_tools"), id: z.string(), serverLabel: z.string(), tools: z.array(MCPTool$outboundSchema), error: z.string().optional(), }).transform((v) => { return remap$(v, { serverLabel: "server_label", }); }); export function mcpListToolsToJSON(mcpListTools: MCPListTools): string { return JSON.stringify(MCPListTools$outboundSchema.parse(mcpListTools)); } export function mcpListToolsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MCPListTools$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MCPListTools' from JSON`, ); }