get_related_events
Find related analytics events within the same table or flow to understand event relationships and implementation context.
Instructions
Find events in the same table/flow as a given event.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_name | Yes | Name of the event to find related events for |
Implementation Reference
- src/mcp-server/tools.js:287-305 (handler)Executes the tool logic: finds all events in the same database table as the input event_name, excluding itself, and returns their names and descriptions.handler: async (args) => { const event = eventsMap.get(args.event_name); if (!event) { throw new NotFoundError('Event', args.event_name); } const relatedEvents = events .filter(e => e.event_table === event.event_table && e.event_name !== args.event_name) .map(e => ({ event_name: e.event_name, description: e.event_description })); return { event: args.event_name, table: event.event_table, related_events: relatedEvents }; }
- src/mcp-server/tools.js:276-286 (schema)Defines the tool's description and input schema, which requires a single 'event_name' string parameter.description: 'Find events in the same table/flow as a given event.', inputSchema: { type: 'object', properties: { event_name: { type: 'string', description: 'Name of the event to find related events for' } }, required: ['event_name'] },
- src/mcp-server/index.js:79-103 (registration)Registers the CallToolRequestHandler which dynamically invokes the handler for 'get_related_events' (and other tools) based on the tools object imported from tools.js.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)Registers the ListToolsRequestHandler which advertises 'get_related_events' (and other tools) from the tools object.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: Object.entries(tools).map(([name, tool]) => ({ name, description: tool.description, inputSchema: tool.inputSchema })) }; });