update_lesson_success
Update lesson success rates in a knowledge graph memory system to track solution effectiveness and improve future interactions.
Instructions
Update the success rate of a lesson after applying its solution
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lessonName | Yes | Name of the lesson to update | |
| success | Yes | Whether the solution was successful |
Implementation Reference
- index.ts:818-843 (handler)The handler function in KnowledgeGraphManager that finds the lesson by name, updates its metadata with new frequency and success rate based on the provided success boolean, and saves the graph.async updateLessonSuccess(lessonName: string, success: boolean): Promise<void> { const graph = await this.loadGraph(); const lesson = graph.entities.find(e => e.name === lessonName && e.entityType === 'lesson') as LessonEntity | undefined; if (!lesson) { throw new Error(`Lesson with name ${lessonName} not found`); } if (!lesson.metadata) { lesson.metadata = { createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), frequency: 0, successRate: 0 }; } const currentSuccessRate = lesson.metadata.successRate ?? 0; const frequency = lesson.metadata.frequency ?? 0; lesson.metadata.frequency = frequency + 1; lesson.metadata.successRate = ((currentSuccessRate * frequency) + (success ? 1 : 0)) / (frequency + 1); lesson.metadata.updatedAt = new Date().toISOString(); await this.saveGraph(graph); }
- index.ts:1186-1196 (schema)The input schema for the update_lesson_success tool, defining lessonName (string) and success (boolean) as required parameters.name: "update_lesson_success", description: "Update the success rate of a lesson after applying its solution", inputSchema: { type: "object", properties: { lessonName: { type: "string", description: "Name of the lesson to update" }, success: { type: "boolean", description: "Whether the solution was successful" } }, required: ["lessonName", "success"] } },
- index.ts:1248-1250 (registration)The dispatch case in the CallToolRequestHandler switch statement that calls the handler on knowledgeGraphManager and returns success message.case "update_lesson_success": await knowledgeGraphManager.updateLessonSuccess(args.lessonName as string, args.success as boolean); return { content: [{ type: "text", text: "Lesson success updated successfully" }] };