





















@@ -1,20 +1,36 @@
11import type { OpenClawConfig } from "../../config/types.openclaw.js";
22import { resolveManifestContractOwnerPluginId } from "../../plugins/plugin-registry.js";
33import type { RuntimeWebSearchMetadata } from "../../secrets/runtime-web-tools.types.js";
4-import {
5-resolveWebSearchDefinition,
6-resolveWebSearchProviderId,
7-runWebSearch,
8-} from "../../web-search/runtime.js";
4+import { resolveWebSearchProviderId, runWebSearch } from "../../web-search/runtime.js";
95import type { AnyAgentTool } from "./common.js";
106import { asToolParamsRecord, jsonResult } from "./common.js";
117import { SEARCH_CACHE } from "./web-search-provider-common.js";
1289+const WebSearchSchema = {
10+type: "object",
11+properties: {
12+query: { type: "string", description: "Search query string." },
13+count: {
14+type: "number",
15+description: "Number of results to return.",
16+minimum: 1,
17+},
18+},
19+} satisfies Record<string, unknown>;
20+21+function isWebSearchDisabled(config?: OpenClawConfig): boolean {
22+const search = config?.tools?.web?.search;
23+return Boolean(search && typeof search === "object" && search.enabled === false);
24+}
25+1326export function createWebSearchTool(options?: {
1427config?: OpenClawConfig;
1528sandboxed?: boolean;
1629runtimeWebSearch?: RuntimeWebSearchMetadata;
1730}): AnyAgentTool | null {
31+if (isWebSearchDisabled(options?.config)) {
32+return null;
33+}
1834const runtimeProviderId =
1935options?.runtimeWebSearch?.selectedProvider ?? options?.runtimeWebSearch?.providerConfigured;
2036const preferRuntimeProviders =
@@ -25,19 +41,13 @@ export function createWebSearchTool(options?: {
2541origin: "bundled",
2642config: options?.config,
2743});
28-const resolved = resolveWebSearchDefinition({
29- ...options,
30- preferRuntimeProviders,
31-});
32-if (!resolved) {
33-return null;
34-}
35443645return {
3746label: "Web Search",
3847name: "web_search",
39-description: resolved.definition.description,
40-parameters: resolved.definition.parameters,
48+description:
49+"Search the web. Returns provider-normalized results for current information lookup.",
50+parameters: WebSearchSchema,
4151execute: async (_toolCallId, args) => {
4252const result = await runWebSearch({
4353config: options?.config,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。