Implementation of MCP for LLM Observability capture to PostHig
Some checks failed
CI - Semantic Release / Semantic Release (push) Failing after 7m48s

This commit is contained in:
2025-07-13 20:42:19 -05:00
commit 05af3880f6
45 changed files with 16894 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import { Logger } from '../utils/logger.util.js';
import { ControllerResponse } from '../types/common.types.js';
import postHogLlmService from '../services/posthog-llm.service.js';
const logger = Logger.forContext('controllers/posthog-llm.controller.ts');
async function capture(args: {
eventName: string;
distinctId: string;
properties: Record<string, unknown>;
}): Promise<ControllerResponse> {
const methodLogger = logger.forMethod('capture');
methodLogger.debug('Capturing PostHog event...');
methodLogger.debug('Arguments:', args);
try {
await postHogLlmService.capture(args);
return {
content: 'Event captured successfully.',
};
} catch (error) {
methodLogger.error('Error capturing event:', error);
const errorMessage =
error instanceof Error ? error.message : 'Unknown error';
methodLogger.error('Error capturing event:', errorMessage);
return {
content: `Failed to capture event: ${errorMessage}`,
};
}
}
export default { capture };