mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-25 07:15:19 +00:00
fix: adjust websearch tool to emphasize that it ISNT 2024, give more info as to current date
This commit is contained in:
@@ -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
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user