/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { type GroundingMetadata } from '@google/genai'; import { BaseToolInvocation, type ToolResult } from './tools.js'; import type { MessageBus } from '../confirmation-bus/message-bus.js'; import { Config } from '../config/config.js'; export interface GroundingChunkWeb { uri?: string; title?: string; } export interface GroundingChunkItem { web?: GroundingChunkWeb; } export interface GroundingSupportSegment { startIndex: number; endIndex: number; text?: string; } export interface GroundingSupportItem { segment?: GroundingSupportSegment; groundingChunkIndices?: number[]; confidenceScores?: number[]; } /** * Parameters for the WebSearchTool. */ export interface WebSearchToolParams { /** * The search query. */ query: string; } /** * Extends ToolResult to include sources for web search. */ export interface WebSearchToolResult extends ToolResult { sources?: GroundingMetadata extends { groundingChunks: GroundingChunkItem[]; } ? GroundingMetadata['groundingChunks'] : GroundingChunkItem[]; } /** * Tool invocation for performing web searches using Google Search via the Gemini API. */ export declare class GoogleWebSearchToolInvocation extends BaseToolInvocation { private readonly config; constructor(config: Config, params: WebSearchToolParams, messageBus?: MessageBus); getToolName(): string; getDescription(): string; execute(signal: AbortSignal): Promise; }