search_events
Search for analytics events by name, description, table, or property usage to find implementation details and specifications.
Instructions
Search for events by name, description, table, or property usage.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Search term for event name or description | |
| table | No | Filter by event table | |
| has_property | No | Filter events that include this property |
Implementation Reference
- src/mcp-server/tools.js:178-223 (handler)The handler function for the search_events tool. It filters the list of events based on optional query (name/description), table, or has_property parameters, expands properties to check inclusion, and returns matching events with their basic info and property count.handler: async (args) => { let results = [...events]; // Filter by query if (args.query) { const query = args.query.toLowerCase(); results = results.filter(e => e.event_name.toLowerCase().includes(query) || e.event_description.toLowerCase().includes(query) ); } // Filter by table if (args.table) { const table = args.table.toLowerCase(); results = results.filter(e => e.event_table.toLowerCase().includes(table) ); } // Filter by property if (args.has_property) { results = results.filter(e => { const expanded = getExpandedProperties(e); const allProps = [ ...expanded.property_groups.flatMap(g => g.properties.map(p => p.name)), ...expanded.additional_properties.map(p => p.name) ]; return allProps.includes(args.has_property); }); } return results.map(e => { const expanded = getExpandedProperties(e); const propertyCount = expanded.property_groups.reduce((sum, g) => sum + g.properties.length, 0) + expanded.additional_properties.length; return { event_name: e.event_name, description: e.event_description, table: e.event_table, property_count: propertyCount }; }); }
- src/mcp-server/tools.js:161-177 (schema)Input schema defining the parameters for the search_events tool: query (string), table (string), has_property (string). All optional.inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search term for event name or description' }, table: { type: 'string', description: 'Filter by event table' }, has_property: { type: 'string', description: 'Filter events that include this property' } } },
- src/mcp-server/index.js:79-103 (registration)MCP server request handler for calling tools. It retrieves the tool by name from the imported tools object (including search_events) and invokes its handler.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const tool = tools[name]; if (!tool) { throw new Error(`Unknown tool: ${name}`); } const result = await tool.handler(args || {}); // Prepend outdated warning if present let responseText = JSON.stringify(result, null, 2); if (outdatedWarning) { responseText = `⚠️ Warning: ${outdatedWarning}\n\n${responseText}`; } return { content: [ { type: 'text', text: responseText } ] }; });
- src/mcp-server/index.js:68-76 (registration)MCP server request handler for listing available tools. It iterates over the tools object, including search_events, and returns their names, descriptions, and schemas.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: Object.entries(tools).map(([name, tool]) => ({ name, description: tool.description, inputSchema: tool.inputSchema })) }; });