search_events
Find analytics events by name, description, table, or property usage to query and validate event specifications from Wiki markdown tables.
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 core handler function for the 'search_events' tool. It filters the list of events based on optional query (name/description), table, or presence of a specific property (via expansion), then returns a summary list with event details and property counts.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 for the 'search_events' tool, defining optional parameters: query (string), table (string), has_property (string).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:78-103 (registration)Registration of all tools (including 'search_events') via the generic CallToolRequestSchema handler, which dynamically retrieves the tool by name from the imported 'tools' object and invokes its handler.// Handle tool calls 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)Registration for listing all tools (including 'search_events') via ListToolsRequestSchema, exposing name, description, and inputSchema from the 'tools' object.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: Object.entries(tools).map(([name, tool]) => ({ name, description: tool.description, inputSchema: tool.inputSchema })) }; });