import type { SharedV2ProviderMetadata } from '../../shared/v2/shared-v2-provider-metadata';

/**
 * Result of a tool call that has been executed by the provider.
 */
export type LanguageModelV2ToolResult = {
  type: 'tool-result';

  /**
   * The ID of the tool call that this result is associated with.
   */
  toolCallId: string;

  /**
   * Name of the tool that generated this result.
   */
  toolName: string;

  /**
   * Result of the tool call. This is a JSON-serializable object.
   */
  result: unknown;

  /**
   * Optional flag if the result is an error or an error message.
   */
  isError?: boolean;

  /**
   * Whether the tool result was generated by the provider.
   * If this flag is set to true, the tool result was generated by the provider.
   * If this flag is not set or is false, the tool result was generated by the client.
   */
  providerExecuted?: boolean;

  /**
   * Additional provider-specific metadata for the tool result.
   */
  providerMetadata?: SharedV2ProviderMetadata;
};
