/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 0b57d1302ac9
 */

import * as z from "zod/v4";
import {
  FunctionT,
  FunctionT$Outbound,
  FunctionT$outboundSchema,
} from "./function.js";
import { ToolTypes, ToolTypes$outboundSchema } from "./tooltypes.js";

export type Tool = {
  type?: ToolTypes | undefined;
  function: FunctionT;
};

/** @internal */
export type Tool$Outbound = {
  type?: string | undefined;
  function: FunctionT$Outbound;
};

/** @internal */
export const Tool$outboundSchema: z.ZodType<Tool$Outbound, Tool> = z.object({
  type: ToolTypes$outboundSchema.optional(),
  function: FunctionT$outboundSchema,
});

export function toolToJSON(tool: Tool): string {
  return JSON.stringify(Tool$outboundSchema.parse(tool));
}
