/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { BaseDeclarativeTool, Kind } from './tools.js';
import { GoogleWebSearchToolInvocation, } from './google-web-search-invocation.js';
/**
 * A tool to perform web searches using Google Search via the Gemini API.
 */
export class GoogleWebSearchTool extends BaseDeclarativeTool {
    config;
    static Name = 'google_web_search';
    constructor(config, messageBus) {
        super(GoogleWebSearchTool.Name, 'GoogleSearch', 'Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.', Kind.Search, {
            type: 'object',
            properties: {
                query: {
                    type: 'string',
                    description: 'The search query to find information on the web.',
                },
            },
            required: ['query'],
        }, false, // output is not markdown
        false, // output cannot be updated
        messageBus);
        this.config = config;
    }
    /**
     * Validates the parameters for the GoogleWebSearchTool.
     * @param params The parameters to validate
     * @returns An error message string if validation fails, null if valid
     */
    validateToolParamValues(params) {
        if (!params.query || params.query.trim() === '') {
            return "The 'query' parameter cannot be empty.";
        }
        return null;
    }
    createInvocation(params, messageBus) {
        return new GoogleWebSearchToolInvocation(this.config, params, messageBus);
    }
}
//# sourceMappingURL=google-web-search.js.map