Tuesday, 25 November 2025

#Module 6 – MCP Attendance Marking Workflow

Module 6 – MCP Attendance Marking Workflow

Module 6 – MCP Attendance Marking Workflow

This module explains how to implement **Attendance Marking Workflow** using Model Context Protocol (MCP).
We will cover:

  • Generating attendance session
  • Fetching student list
  • Marking present/absent
  • Storing attendance with MCP
  • Validating timetable hour

🏫 Real Example

Semester S3, Subject SUB301 – Data Structures, Staff T5 taking class at
Monday – Hour 2.


1️⃣ Generate Attendance Session

# Create a new attendance session
mcp call academic_tracker.create '{
  "entity": "attendance_session",
  "data": {
    "id": "SES1001",
    "date": "2025-08-10",
    "semesterId": "S3",
    "subjectId": "SUB301",
    "hour": 2,
    "day": "Monday",
    "staffId": "T5"
  }
}'

2️⃣ Fetch Students of the Semester

# Fetch the list of 60 students in S3
mcp call academic_tracker.read '{
  "entity": "students",
  "filter": { "semesterId": "S3" }
}'

3️⃣ Mark Attendance – Present / Absent

Each student will be marked one by one (or in batch).

# Mark present
mcp call academic_tracker.create '{
  "entity": "attendance",
  "data": {
    "studentId": "STU3301",
    "sessionId": "SES1001",
    "status": "present"
  }
}'
# Mark absent
mcp call academic_tracker.create '{
  "entity": "attendance",
  "data": {
    "studentId": "STU3302",
    "sessionId": "SES1001",
    "status": "absent"
  }
}'

4️⃣ Batch Marking (Optional)

Useful for large classes (60 per semester).

{
  "sessionId": "SES1001",
  "attendance": [
    { "studentId": "STU3301", "status": "present" },
    { "studentId": "STU3302", "status": "absent" },
    { "studentId": "STU3303", "status": "present" }
  ]
}

5️⃣ Validate Timetable Hour (Important Safety Check)

# Ensure the class is actually scheduled for that hour
mcp call academic_tracker.read '{
  "entity": "timetable",
  "filter": {
    "semesterId": "S3",
    "day": "Monday",
    "hour": 2,
    "subjectId": "SUB301"
  }
}'

6️⃣ Final Stored Attendance (Returned JSON)

{
  "status": "success",
  "sessionId": "SES1001",
  "recordsStored": 60,
  "message": "Attendance saved for all students."
}

🎉 Module 6 Completed!

You now understand how to mark attendance using MCP with: sessions, validation, batch handling, and student lists.

No comments:

Post a Comment

#MCP Index

MCP Tutorial – Module Index MCP Tutorial – 12 Modules Latest Edition for AU-CSE Final year Students Module 1 Introducti...