Statt eines "update_lesson", das die ganze Stunde inkl. Verlaufsplan als ein großes JSON-Objekt tauscht, gezielte kleine Tools je Teiloperation (Nutzervorschlag): create/update_unit, create/update_lesson (Metadaten ohne Phasen), add/update/remove_lesson_phase (je eine Phase), download_lesson_attachment (Base64, auf 3 MB gedeckelt). Verkürzt das Lesen-Schreiben-Zeitfenster je Operation und liefert lesbare Diffs für den Bestätigungsdialog statt eines Objekt-Dumps. ILessonRepository um GetById ergänzt (fehlte bisher, war aber Voraussetzung für jedes der neuen Tools). get_lesson_plans liefert jetzt zusätzlich Phase-IDs und Attachment-Metadaten, damit ein Client sie gezielt referenzieren kann. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
55 lines
2.7 KiB
C#
55 lines
2.7 KiB
C#
using LehrerApp.Core.Models;
|
|
|
|
namespace LehrerApp.Desktop.Services.Mcp.Tools;
|
|
|
|
// Schlanke, bewusst nicht 1:1 zu den LiteDB-Entities gehaltene Rückgabetypen: verhindert, dass ein
|
|
// später zum Modell hinzugefügtes Feld (z.B. ein neues personenbezogenes Attribut) unbeabsichtigt
|
|
// über ein MCP-Tool nach außen dringt, nur weil es Teil der Entity-Klasse ist.
|
|
|
|
public record StudentDto(Guid Id, string FirstName, string LastName, bool IsActive);
|
|
|
|
public record ExamResultDto(Guid StudentId, double TotalPoints, string? Grade, bool Absent);
|
|
|
|
public record ExamDto(
|
|
Guid Id, Guid GroupId, string Title, DateOnly Date, ExamStatus Status, Niveau? Niveau,
|
|
List<ExamResultDto>? Results);
|
|
|
|
public record GradeDto(
|
|
Guid Id, Guid StudentId, Guid GroupId, GradeCategory Category, string Value, DateOnly Date,
|
|
double Weight, string? Note);
|
|
|
|
public record TimetableSlotDto(Guid Id, Guid GroupId, DayOfWeek Weekday, int PeriodNumber, string? Room);
|
|
|
|
public record TimeEntryDto(
|
|
Guid Id, Guid? TaskId, string Category, Guid? GroupId, DateOnly Date,
|
|
TimeOnly? StartTime, TimeOnly? EndTime, int DurationMinutes, string? Description);
|
|
|
|
public record LessonPhaseDto(Guid Id, string Name, int DurationMinutes, string Activity, string Material, string Shorthand);
|
|
|
|
public record LessonAttachmentDto(string StorageId, string FileName, long SizeBytes);
|
|
|
|
public record LessonDto(
|
|
Guid Id, Guid UnitId, Guid GroupId, DateOnly Date, int? LessonNumber, string Topic,
|
|
string? Homework, LessonStatus Status, List<LessonPhaseDto> Phases,
|
|
List<LessonAttachmentDto> Attachments);
|
|
|
|
/// <summary>Ergebnis von "download_lesson_attachment": Inhalt Base64-kodiert, weil MCP-Tool-Antworten
|
|
/// als JSON/Text übertragen werden. Bewusst kein Ressourcen-URI-Mechanismus (siehe Planungsdokument) -
|
|
/// dafür müsste der Server MCP-Resources anbieten, was über den Rahmen dieses Tools hinausgeht;
|
|
/// stattdessen deckelt <see cref="LessonPlanTools.MaxInlineAttachmentBytes"/> die Größe.</summary>
|
|
public record AttachmentContentDto(string FileName, long SizeBytes, string Base64Content);
|
|
|
|
public record UnitDto(
|
|
Guid Id, Guid GroupId, string Title, DateOnly? StartDate, DateOnly? EndDate,
|
|
UnitStatus Status, List<string> Competencies);
|
|
|
|
public record LessonPlanResultDto(List<UnitDto> Units, List<LessonDto> Lessons);
|
|
|
|
public record GroupMembershipDto(
|
|
Guid Id, Guid StudentId, Guid GroupId, MembershipPeriod Period,
|
|
DateOnly? JoinedAt, DateOnly? LeftAt, Niveau? Niveau);
|
|
|
|
/// <summary>Ergebnis eines Write-Tools (Phase 2, siehe Planungsdokument): <see cref="Applied"/> ist
|
|
/// nur dann true, wenn der Nutzer die Änderung im Bestätigungsdialog angenommen hat.</summary>
|
|
public record WriteResultDto(bool Applied, Guid? Id, string Message);
|