Spaces:
Sleeping
Sleeping
| 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 | |
| } | |
| } | |