fix: adjust websearch tool to emphasize that it ISNT 2024, give more info as to current date

This commit is contained in:
Aiden Cline
2026-01-15 20:50:18 -06:00
parent 46be47d0be
commit 1a43e5fe87
2 changed files with 100 additions and 91 deletions

View File

@@ -36,8 +36,11 @@ interface McpSearchResponse {
}
}
export const WebSearchTool = Tool.define("websearch", {
description: DESCRIPTION,
export const WebSearchTool = Tool.define("websearch", async () => {
return {
get description() {
return DESCRIPTION.replace("{{date}}", new Date().toISOString().slice(0, 10))
},
parameters: z.object({
query: z.string().describe("Websearch query"),
numResults: z.number().optional().describe("Number of search results to return (default: 8)"),
@@ -50,7 +53,9 @@ export const WebSearchTool = Tool.define("websearch", {
type: z
.enum(["auto", "fast", "deep"])
.optional()
.describe("Search type - 'auto': balanced search (default), 'fast': quick results, 'deep': comprehensive search"),
.describe(
"Search type - 'auto': balanced search (default), 'fast': quick results, 'deep': comprehensive search",
),
contextMaxCharacters: z
.number()
.optional()
@@ -141,4 +146,5 @@ export const WebSearchTool = Tool.define("websearch", {
throw error
}
},
}
})

View File

@@ -9,3 +9,6 @@ Usage notes:
- Search types: 'auto' (balanced), 'fast' (quick results), 'deep' (comprehensive search)
- Configurable context length for optimal LLM integration
- Domain filtering and advanced search options available
Today's date is {{date}}. You MUST use this year when searching for recent information or current events
- Example: If today is 2025-07-15 and the user asks for "latest AI news", search for "AI news 2025", NOT "AI news 2024"