File size: 5,299 Bytes
942216e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
from enum import Enum
from typing import Dict, List, Any, Optional, Union, Literal
from pydantic import BaseModel, Field


class InteractionType(str, Enum):
    TEXT = "text"
    QUESTION = "question"
    ASSESSMENT = "assessment"
    EXPLANATION = "explanation"
    FEEDBACK = "feedback"
    SUMMARY = "summary"


class ContentFormat(str, Enum):
    TEXT = "text"
    MARKDOWN = "markdown"
    HTML = "html"
    JSON = "json"


class EducationalLevel(str, Enum):
    ELEMENTARY = "elementary"
    MIDDLE_SCHOOL = "middle_school"
    HIGH_SCHOOL = "high_school"
    UNDERGRADUATE = "undergraduate"
    GRADUATE = "graduate"
    PROFESSIONAL = "professional"


class MCPRequest(BaseModel):
    context_id: Optional[str] = Field(None)
    interaction_type: InteractionType = Field(...)
    content: Dict[str, Any] = Field(...)
    format: ContentFormat = Field(ContentFormat.TEXT)
    metadata: Dict[str, Any] = Field(default_factory=dict)


class MCPResponse(BaseModel):
    context_id: str = Field(...)
    interaction_type: InteractionType = Field(...)
    content: Dict[str, Any] = Field(...)
    format: ContentFormat = Field(...)
    metadata: Dict[str, Any] = Field(default_factory=dict)
    model_info: Dict[str, Any] = Field(default_factory=dict)


class TextRequest(MCPRequest):
    interaction_type: Literal[InteractionType.TEXT] = Field(InteractionType.TEXT)
    content: Dict[str, Any] = Field(...)


class TextResponse(MCPResponse):
    interaction_type: Literal[InteractionType.TEXT] = Field(InteractionType.TEXT)
    content: Dict[str, Any] = Field(...)


class QuestionRequest(MCPRequest):
    interaction_type: Literal[InteractionType.QUESTION] = Field(InteractionType.QUESTION)
    content: Dict[str, Any] = Field(...)


class QuestionResponse(MCPResponse):
    interaction_type: Literal[InteractionType.QUESTION] = Field(InteractionType.QUESTION)
    content: Dict[str, Any] = Field(...)


class AssessmentRequest(MCPRequest):
    interaction_type: Literal[InteractionType.ASSESSMENT] = Field(InteractionType.ASSESSMENT)
    content: Dict[str, Any] = Field(...)


class AssessmentResponse(MCPResponse):
    interaction_type: Literal[InteractionType.ASSESSMENT] = Field(InteractionType.ASSESSMENT)
    content: Dict[str, Any] = Field(...)


class ExplanationRequest(MCPRequest):
    interaction_type: Literal[InteractionType.EXPLANATION] = Field(InteractionType.EXPLANATION)
    content: Dict[str, Any] = Field(...)


class ExplanationResponse(MCPResponse):
    interaction_type: Literal[InteractionType.EXPLANATION] = Field(InteractionType.EXPLANATION)
    content: Dict[str, Any] = Field(...)


class FeedbackRequest(MCPRequest):
    interaction_type: Literal[InteractionType.FEEDBACK] = Field(InteractionType.FEEDBACK)
    content: Dict[str, Any] = Field(...)


class FeedbackResponse(MCPResponse):
    interaction_type: Literal[InteractionType.FEEDBACK] = Field(InteractionType.FEEDBACK)
    content: Dict[str, Any] = Field(...)


class SummaryRequest(MCPRequest):
    interaction_type: Literal[InteractionType.SUMMARY] = Field(InteractionType.SUMMARY)
    content: Dict[str, Any] = Field(...)


class SummaryResponse(MCPResponse):
    interaction_type: Literal[InteractionType.SUMMARY] = Field(InteractionType.SUMMARY)
    content: Dict[str, Any] = Field(...)


class LearningObjective(BaseModel):
    id: str = Field(...)
    description: str = Field(...)
    taxonomy_level: str = Field(...)
    subject_area: str = Field(...)
    prerequisites: List[str] = Field(default_factory=list)


class StudentProfile(BaseModel):
    id: str = Field(...)
    name: str = Field(...)
    educational_level: EducationalLevel = Field(...)
    learning_style: str = Field(None)
    interests: List[str] = Field(default_factory=list)
    strengths: List[str] = Field(default_factory=list)
    areas_for_improvement: List[str] = Field(default_factory=list)
    completed_objectives: List[str] = Field(default_factory=list)
    current_objectives: List[str] = Field(default_factory=list)


class ContentAdaptationRequest(MCPRequest):
    interaction_type: Literal[InteractionType.TEXT] = Field(InteractionType.TEXT)
    content: Dict[str, Any] = Field(...)
    student_profile: StudentProfile = Field(...)
    learning_objectives: List[LearningObjective] = Field(...)


class ContentAdaptationResponse(MCPResponse):
    interaction_type: Literal[InteractionType.TEXT] = Field(InteractionType.TEXT)
    content: Dict[str, Any] = Field(...)
    adaptations_applied: List[str] = Field(...)
    recommended_activities: List[Dict[str, Any]] = Field(default_factory=list)


MCP_VERSION = "1.0.0"
MCP_SPEC_URL = "https://example.com/mcp-specification"

MCP_CAPABILITIES = {
    "version": MCP_VERSION,
    "supported_interaction_types": [e.value for e in InteractionType],
    "supported_content_formats": [e.value for e in ContentFormat],
    "supported_educational_levels": [e.value for e in EducationalLevel],
    "features": {
        "context_management": True,
        "state_persistence": True,
        "content_adaptation": True,
        "assessment": True,
        "feedback": True,
        "learning_path_generation": True
    }
}