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",