Skip to main content
Glama
jakedx6
by jakedx6

get_search_analytics

Analyze search patterns and performance metrics within projects to identify trends and optimize search functionality.

Instructions

Get analytics about search patterns and performance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
time_rangeNoTime range for analyticsweek
project_idNoProject to filter analytics (optional)
include_performanceNoInclude search performance metrics

Implementation Reference

  • Main handler function that validates input with schema, logs the request, calls the analytics calculator, and returns formatted results.
    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 validation schema defining the input parameters: time_range (enum), optional project_id, and optional include_performance.
    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) })
  • Registration of the handler function under the key 'get_search_analytics' in the intelligentSearchHandlers export.
    export const intelligentSearchHandlers = { universal_search: universalSearch, semantic_search: semanticSearch, get_search_suggestions: getSearchSuggestions, get_search_analytics: getSearchAnalytics }
  • MCPTool object definition with name, description, and inputSchema for the get_search_analytics tool.
    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' } } } }
  • Helper function that computes the actual search analytics data, returning mock statistics for searches, trends, and performance.
    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 } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jakedx6/helios9-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server