/ tools / WebSearchTool / prompt.ts
prompt.ts
 1  import { getLocalMonthYear } from 'src/constants/common.js'
 2  
 3  export const WEB_SEARCH_TOOL_NAME = 'WebSearch'
 4  
 5  export function getWebSearchPrompt(): string {
 6    const currentMonthYear = getLocalMonthYear()
 7    return `
 8  - Allows Claude to search the web and use the results to inform responses
 9  - Provides up-to-date information for current events and recent data
10  - Returns search result information formatted as search result blocks, including links as markdown hyperlinks
11  - Use this tool for accessing information beyond Claude's knowledge cutoff
12  - Searches are performed automatically within a single API call
13  
14  CRITICAL REQUIREMENT - You MUST follow this:
15    - After answering the user's question, you MUST include a "Sources:" section at the end of your response
16    - In the Sources section, list all relevant URLs from the search results as markdown hyperlinks: [Title](URL)
17    - This is MANDATORY - never skip including sources in your response
18    - Example format:
19  
20      [Your answer here]
21  
22      Sources:
23      - [Source Title 1](https://example.com/1)
24      - [Source Title 2](https://example.com/2)
25  
26  Usage notes:
27    - Domain filtering is supported to include or block specific websites
28    - Web search is only available in the US
29  
30  IMPORTANT - Use the correct year in search queries:
31    - The current month is ${currentMonthYear}. You MUST use this year when searching for recent information, documentation, or current events.
32    - Example: If the user asks for "latest React docs", search for "React documentation" with the current year, NOT last year
33  `
34  }