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", {
|
export const WebSearchTool = Tool.define("websearch", async () => {
|
||||||
description: DESCRIPTION,
|
return {
|
||||||
|
get description() {
|
||||||
|
return DESCRIPTION.replace("{{date}}", new Date().toISOString().slice(0, 10))
|
||||||
|
},
|
||||||
parameters: z.object({
|
parameters: z.object({
|
||||||
query: z.string().describe("Websearch query"),
|
query: z.string().describe("Websearch query"),
|
||||||
numResults: z.number().optional().describe("Number of search results to return (default: 8)"),
|
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
|
type: z
|
||||||
.enum(["auto", "fast", "deep"])
|
.enum(["auto", "fast", "deep"])
|
||||||
.optional()
|
.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
|
contextMaxCharacters: z
|
||||||
.number()
|
.number()
|
||||||
.optional()
|
.optional()
|
||||||
@@ -141,4 +146,5 @@ export const WebSearchTool = Tool.define("websearch", {
|
|||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,3 +9,6 @@ Usage notes:
|
|||||||
- Search types: 'auto' (balanced), 'fast' (quick results), 'deep' (comprehensive search)
|
- Search types: 'auto' (balanced), 'fast' (quick results), 'deep' (comprehensive search)
|
||||||
- Configurable context length for optimal LLM integration
|
- Configurable context length for optimal LLM integration
|
||||||
- Domain filtering and advanced search options available
|
- 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