From 2fd7c054ae2efd2811ed7e3ab30ab51d8a358a61 Mon Sep 17 00:00:00 2001 From: "clawsweeper[bot]" <274271284+clawsweeper[bot]@users.noreply.github.com> Date: Thu, 30 Apr 2026 22:42:51 -0700 Subject: [PATCH] fix(search): share web search count schema limit Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com> --- src/agents/tools/web-search.test.ts | 13 +++++++++++++ src/agents/tools/web-search.ts | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/agents/tools/web-search.test.ts b/src/agents/tools/web-search.test.ts index 31069d23657..cb6ed3fe124 100644 --- a/src/agents/tools/web-search.test.ts +++ b/src/agents/tools/web-search.test.ts @@ -1,11 +1,24 @@ import { describe, expect, it } from "vitest"; import { + MAX_SEARCH_COUNT, buildUnsupportedSearchFilterResponse, isoToPerplexityDate, normalizeToIsoDate, normalizeFreshness, } from "./web-search-provider-common.js"; import { mergeScopedSearchConfig } from "./web-search-provider-config.js"; +import { createWebSearchTool } from "./web-search.js"; + +describe("web_search tool schema", () => { + it("advertises the shared runtime count limit", () => { + const tool = createWebSearchTool(); + const parameters = tool?.parameters as + | { properties?: { count?: { maximum?: unknown } } } + | undefined; + + expect(parameters?.properties?.count?.maximum).toBe(MAX_SEARCH_COUNT); + }); +}); describe("web_search freshness normalization", () => { it("accepts Brave shortcut values and maps for Perplexity", () => { diff --git a/src/agents/tools/web-search.ts b/src/agents/tools/web-search.ts index 789b24dda2a..4a3565e2e40 100644 --- a/src/agents/tools/web-search.ts +++ b/src/agents/tools/web-search.ts @@ -4,7 +4,7 @@ import type { RuntimeWebSearchMetadata } from "../../secrets/runtime-web-tools.t import { resolveWebSearchProviderId, runWebSearch } from "../../web-search/runtime.js"; import type { AnyAgentTool } from "./common.js"; import { asToolParamsRecord, jsonResult } from "./common.js"; -import { SEARCH_CACHE } from "./web-search-provider-common.js"; +import { MAX_SEARCH_COUNT, SEARCH_CACHE } from "./web-search-provider-common.js"; const WebSearchSchema = { type: "object", @@ -14,7 +14,7 @@ const WebSearchSchema = { type: "number", description: "Number of results to return.", minimum: 1, - maximum: 20, + maximum: MAX_SEARCH_COUNT, }, country: { type: "string",