/** * Canonical MCP Response Examples * * Type-safe test fixtures for validating MCP tool responses. * These serve as the single source of truth for expected response structures. * * Usage: * - Import in smoke tests for response drift detection * - Import in backend unit/integration tests for validation * - TypeScript compiler enforces type safety against actual response types * * @see scripts/mcp-ci-tests.mjs - Uses these for canonical schema validation */ /** * Canonical example for conversation.send-message response * * Structure matches ConversationMessageResponse from backend types. * This is the expected response when sending a message to start or continue a conversation. */ export const CONVERSATION_SEND_MESSAGE_EXAMPLE = { message: { id: 'msg-user-1', conversationId: 'conv-canonical', content: 'Hello from canonical schema', role: 'user' as const, userId: 'user-123', sequence: 0, createdAt: '2025-01-01T00:00:00.000Z', metadata: {} }, created: true, conversationId: 'conv-canonical', messageId: 'msg-user-1', sequence: 0, title: 'Test Conversation', assistantMessage: { id: 'msg-assistant-1', conversationId: 'conv-canonical', content: 'Sample assistant reply' } } as const; /** * Canonical example for conversation.get-history response * * Structure matches ConversationHistoryResponse from backend types. * This is the expected response when fetching conversation history. * * NOTE: Based on actual backend response (verified 2025-11-12). * The history object does NOT include title, createdAt, or lastMessageAt at the top level. */ export const CONVERSATION_GET_HISTORY_EXAMPLE = { history: { conversationId: 'conv-canonical', messages: [ { id: 'msg-user-1', content: 'Hello from canonical schema', role: 'user' as const, userId: 'user-123', sequence: 0, createdAt: '2025-01-01T00:00:00.000Z', metadata: {} }, { id: 'msg-assistant-1', content: 'Hi there', role: 'assistant' as const, userId: 'user-123', sequence: 1, createdAt: '2025-01-01T00:00:01.000Z', metadata: {} } ], hasMore: false, nextCursor: null, messageCount: 2 } } as const; /** * All canonical examples indexed by tool name * * Keys match MCP tool names (e.g., 'conversation.send-message') */ export const CANONICAL_EXAMPLES = { 'conversation.send-message': CONVERSATION_SEND_MESSAGE_EXAMPLE, 'conversation.get-history': CONVERSATION_GET_HISTORY_EXAMPLE } as const; /** * Type helper to get the canonical example for a tool */ export type CanonicalExample = typeof CANONICAL_EXAMPLES[T];