UNPKG

systemprompt-mcp-interview

Version:

A specialized Model Context Protocol (MCP) server that enables AI-powered interview roleplay scenarios

83 lines 3.37 kB
import { sendJsonResultNotification, sendOperationNotification } from "./notifications.js"; import { SystemPromptService } from "../services/systemprompt-service.js"; import { server } from "../server.js"; /** * Handles sending an email via SystemPrompt API * @param result The LLM result * @returns The tool response */ export async function handleConfigureInterviewCallback(result) { try { if (result.content.type !== "text") { throw new Error("Expected text content"); } const interviewPlan = JSON.parse(result.content.text); if (!interviewPlan.interviewId || !interviewPlan.interviewPlan || !interviewPlan.metadata || !interviewPlan.systemPromptMetadata) { throw new Error("Invalid interview plan format"); } const blockData = { content: result.content.text, prefix: interviewPlan.systemPromptMetadata.prefix, metadata: { title: interviewPlan.systemPromptMetadata.title, description: interviewPlan.systemPromptMetadata.description, tag: ["mcp_systemprompt_interview", "interview"], }, }; await sendJsonResultNotification(JSON.stringify(blockData)); const systemprompt = SystemPromptService.getInstance(); await systemprompt.createBlock(blockData); server.sendResourceListChanged(); const message = `Successfully created interview plan ${interviewPlan.interviewId} with ${interviewPlan.metadata.totalQuestions} questions`; await sendOperationNotification("configure_interview", message); return message; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error"; await sendOperationNotification("configure_interview", `Failed to configure interview: ${errorMessage}`); throw error; } } /** * Handles saving the CV summary to SystemPrompt * @param result The LLM result * @returns The tool response */ export async function handleSummarizeCVCallback(result) { if (result.content.type !== "text") { throw new Error("Expected text content"); } let cvSummary; try { cvSummary = JSON.parse(result.content.text); if (!cvSummary.personalInfo || !cvSummary.skills || !cvSummary.metadata || !cvSummary.systemPromptMetadata) { throw new Error("Invalid CV summary format"); } } catch (error) { throw new Error("Invalid CV summary format"); } const blockData = { content: result.content.text, prefix: cvSummary.systemPromptMetadata.prefix, metadata: { title: cvSummary.systemPromptMetadata.title, description: cvSummary.systemPromptMetadata.description, tag: ["mcp_systemprompt_interview", "cv"], }, }; await sendJsonResultNotification(JSON.stringify(blockData)); const systemprompt = SystemPromptService.getInstance(); await systemprompt.createBlock(blockData); server.sendResourceListChanged(); const message = `Successfully processed CV summary for ${cvSummary.metadata.primaryDomain} role`; await sendOperationNotification("summarize_cv", message); return message; } //# sourceMappingURL=callbacks.js.map