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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

/**
 * Additional properties describing a Tool to clients.
 *
 * @remarks
 *
 * NOTE: all properties in ToolAnnotations are **hints**.
 * They are not guaranteed to provide a faithful description of
 * tool behavior (including descriptive properties like `title`).
 *
 * Clients should never make tool use decisions based on ToolAnnotations
 * received from untrusted servers.
 */
export type ToolAnnotations = {
  title?: string | null | undefined;
  readOnlyHint?: boolean | null | undefined;
  destructiveHint?: boolean | null | undefined;
  idempotentHint?: boolean | null | undefined;
  openWorldHint?: boolean | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const ToolAnnotations$inboundSchema: z.ZodType<
  ToolAnnotations,
  unknown
> = z.object({
  title: z.nullable(z.string()).optional(),
  readOnlyHint: z.nullable(z.boolean()).optional(),
  destructiveHint: z.nullable(z.boolean()).optional(),
  idempotentHint: z.nullable(z.boolean()).optional(),
  openWorldHint: z.nullable(z.boolean()).optional(),
}).catchall(z.any());

export function toolAnnotationsFromJSON(
  jsonString: string,
): SafeParseResult<ToolAnnotations, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ToolAnnotations$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ToolAnnotations' from JSON`,
  );
}
