get_search_analytics
Retrieve search pattern analytics and performance metrics for Helios-9 projects to optimize search functionality and user experience.
Instructions
Get analytics about search patterns and performance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time_range | No | Time range for analytics | week |
| project_id | No | Project to filter analytics (optional) | |
| include_performance | No | Include search performance metrics |
Implementation Reference
- src/tools/intelligent-search.ts:371-383 (handler)The main handler function for the 'get_search_analytics' tool. Parses input arguments using Zod schema, logs the request, calls the calculateSearchAnalytics helper, and returns the analytics data.export const getSearchAnalytics = requireAuth(async (args: any) => { const { time_range, project_id, include_performance } = GetSearchAnalyticsSchema.parse(args) logger.info('Getting search analytics', { time_range, project_id }) const analytics = await calculateSearchAnalytics(time_range, project_id, include_performance) return { time_range, project_id, ...analytics } })
- Zod schema for validating input parameters of the get_search_analytics tool: time_range (enum), project_id (optional string), include_performance (boolean).const GetSearchAnalyticsSchema = z.object({ time_range: z.enum(['hour', 'day', 'week', 'month']).default('week'), project_id: z.string().optional(), include_performance: z.boolean().default(true) })
- src/tools/intelligent-search.ts:340-363 (registration)MCPTool object definition exporting the tool specification including name 'get_search_analytics', description, and inputSchema for registration.export const getSearchAnalyticsTool: MCPTool = { name: 'get_search_analytics', description: 'Get analytics about search patterns and performance', inputSchema: { type: 'object', properties: { time_range: { type: 'string', enum: ['hour', 'day', 'week', 'month'], default: 'week', description: 'Time range for analytics' }, project_id: { type: 'string', description: 'Project to filter analytics (optional)' }, include_performance: { type: 'boolean', default: true, description: 'Include search performance metrics' } } } }
- src/tools/intelligent-search.ts:667-672 (registration)Registration of the getSearchAnalytics handler in the intelligentSearchHandlers object map, keyed by tool name.export const intelligentSearchHandlers = { universal_search: universalSearch, semantic_search: semanticSearch, get_search_suggestions: getSearchSuggestions, get_search_analytics: getSearchAnalytics }
- Helper function that computes the search analytics data (currently a placeholder returning mock data), called by the main handler.async function calculateSearchAnalytics(timeRange: string, projectId?: string, includePerformance?: boolean): Promise<any> { // Placeholder for search analytics return { total_searches: 150, unique_queries: 45, avg_results_per_search: 8.3, top_search_terms: ['api', 'documentation', 'tasks', 'project'], search_trends: { documents: 45, tasks: 35, projects: 20 }, performance: includePerformance ? { avg_search_time: 125, cache_hit_rate: 78.5 } : undefined } }