/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
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, z.ZodTypeDef, Tool> =
  z.object({
    type: ToolTypes$outboundSchema.optional(),
    function: FunctionT$outboundSchema,
  });

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