/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 30a0bf3d72fd */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import * as discriminatedUnionTypes from "../../types/discriminatedUnion.js"; import { discriminatedUnion } from "../../types/discriminatedUnion.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AudioContent, AudioContent$inboundSchema } from "./audiocontent.js"; import { ConnectorToolCallMetadata, ConnectorToolCallMetadata$inboundSchema, } from "./connectortoolcallmetadata.js"; import { EmbeddedResource, EmbeddedResource$inboundSchema, } from "./embeddedresource.js"; import { ImageContent, ImageContent$inboundSchema } from "./imagecontent.js"; import { ResourceLink, ResourceLink$inboundSchema } from "./resourcelink.js"; import { TextContent, TextContent$inboundSchema } from "./textcontent.js"; export type ConnectorToolCallResponseContent = | TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource | discriminatedUnionTypes.Unknown<"type">; /** * Response from calling an MCP tool. * * @remarks * * We override mcp_types.CallToolResult because: * - Models only support `content`, not `structuredContent` at top level * - Downstream consumers (le-chat, etc.) need structuredContent/isError/_meta via metadata * * SYNC: Keep in sync with Harmattan (orchestrator) for harmonized tool result processing. */ export type ConnectorToolCallResponse = { content: Array< | TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource | discriminatedUnionTypes.Unknown<"type"> >; metadata?: ConnectorToolCallMetadata | null | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const ConnectorToolCallResponseContent$inboundSchema: z.ZodType< ConnectorToolCallResponseContent, unknown > = discriminatedUnion("type", { text: TextContent$inboundSchema, image: ImageContent$inboundSchema, audio: AudioContent$inboundSchema, resource_link: ResourceLink$inboundSchema, resource: EmbeddedResource$inboundSchema, }); export function connectorToolCallResponseContentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConnectorToolCallResponseContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConnectorToolCallResponseContent' from JSON`, ); } /** @internal */ export const ConnectorToolCallResponse$inboundSchema: z.ZodType< ConnectorToolCallResponse, unknown > = z.object({ content: z.array(discriminatedUnion("type", { text: TextContent$inboundSchema, image: ImageContent$inboundSchema, audio: AudioContent$inboundSchema, resource_link: ResourceLink$inboundSchema, resource: EmbeddedResource$inboundSchema, })), metadata: z.nullable(ConnectorToolCallMetadata$inboundSchema).optional(), }).catchall(z.any()); export function connectorToolCallResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConnectorToolCallResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConnectorToolCallResponse' from JSON`, ); }