update_lesson_success
Track and update lesson success rates in the Knowledge Graph Memory Server to improve solution accuracy and enhance learning from past 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 main handler function in KnowledgeGraphManager that updates the success rate and frequency metadata for a specific lesson based on whether the solution was successful.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:1185-1196 (schema)The input schema definition for the update_lesson_success tool, specifying 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 switch case in the CallToolRequestSchema handler that registers and dispatches calls to the updateLessonSuccess handler.case "update_lesson_success": await knowledgeGraphManager.updateLessonSuccess(args.lessonName as string, args.success as boolean); return { content: [{ type: "text", text: "Lesson success updated successfully" }] };