File size: 7,382 Bytes
411f252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# TutorX-MCP API Documentation

This document provides comprehensive documentation for the TutorX-MCP API for developers who want to integrate with the system.

## API Overview

The TutorX-MCP server exposes a Model Context Protocol (MCP) API that allows clients to interact with various educational tools and resources. This API follows the standard MCP protocol as defined in [MCP Specification](https://github.com/anthropics/anthropic-tools/blob/main/mcp/README.md).

## Authentication

For production deployments, all API requests should include an API key in the `Authorization` header:

```
Authorization: Bearer your-api-key-here
```

## Base URL

Default: `http://localhost:8000`

For production: See your deployment configuration

## Tools API

Tools represent functionality that can be invoked by MCP clients. Each tool is accessed via:

```
POST /tools/{tool_name}
Content-Type: application/json

{
  "param1": "value1",
  "param2": "value2"
}
```

### Core Features

#### Adaptive Learning Engine

##### `assess_skill`

Assess a student's skill level on a specific concept.

**Request:**
```json
{
  "student_id": "student123",
  "concept_id": "math_algebra_basics"
}
```

**Response:**
```json
{
  "student_id": "student123",
  "concept_id": "math_algebra_basics",
  "skill_level": 0.75,
  "confidence": 0.85,
  "recommendations": [
    "Practice more complex problems",
    "Review related concept: algebra_linear_equations"
  ],
  "timestamp": "2025-06-07T10:30:45.123456"
}
```

##### `generate_quiz`

Generate a quiz based on specified concepts and difficulty.

**Request:**
```json
{
  "concept_ids": ["math_algebra_basics", "math_algebra_linear_equations"],
  "difficulty": 2
}
```

**Response:**
```json
{
  "quiz_id": "q12345",
  "concept_ids": ["math_algebra_basics", "math_algebra_linear_equations"],
  "difficulty": 2,
  "questions": [
    {
      "id": "q1",
      "text": "Solve for x: 2x + 3 = 7",
      "type": "algebraic_equation",
      "answer": "x = 2",
      "solution_steps": [
        "2x + 3 = 7",
        "2x = 7 - 3",
        "2x = 4",
        "x = 4/2 = 2"
      ]
    }
  ]
}
```

#### Feedback System

##### `analyze_error_patterns`

Analyze common error patterns for a student on a specific concept.

**Request:**
```json
{
  "student_id": "student123",
  "concept_id": "math_algebra_basics"
}
```

**Response:**
```json
{
  "student_id": "student123",
  "concept_id": "math_algebra_basics",
  "common_errors": [
    {
      "type": "sign_error",
      "frequency": 0.65,
      "example": "2x - 3 = 5 β†’ 2x = 5 - 3 β†’ 2x = 2 β†’ x = 1 (should be x = 4)"
    }
  ],
  "recommendations": [
    "Practice more sign manipulation problems"
  ]
}
```

### Advanced Features

#### Neurological Engagement Monitor

##### `analyze_cognitive_state`

Analyze EEG data to determine cognitive state.

**Request:**
```json
{
  "eeg_data": {
    "channels": [...],
    "sampling_rate": 256,
    "duration": 10.0
  }
}
```

**Response:**
```json
{
  "attention_level": 0.82,
  "cognitive_load": 0.65,
  "stress_level": 0.25,
  "recommendations": [
    "Student is engaged but approaching cognitive overload",
    "Consider simplifying next problems slightly"
  ],
  "timestamp": "2025-06-07T10:32:15.123456"
}
```

### External Integrations

#### Learning Management Systems

##### `lms_sync_grades`

Sync grades with a Learning Management System.

**Request:**
```json
{
  "lms_type": "canvas",
  "api_url": "https://canvas.example.com/api/v1",
  "api_key": "your-api-key",
  "course_id": "course123",
  "assignment_id": "assign456",
  "grades": [
    {
      "student_id": "student123",
      "score": 85.5
    }
  ]
}
```

**Response:**
```json
{
  "success": true,
  "timestamp": "2025-06-07T10:35:22.123456",
  "message": "Grades successfully synced"
}
```

#### Open Educational Resources

##### `oer_search`

Search for educational resources in OER repositories.

**Request:**
```json
{
  "repository_url": "https://oer.example.com/api",
  "query": "linear equations",
  "subject": "mathematics",
  "grade_level": "8"
}
```

**Response:**
```json
{
  "success": true,
  "count": 2,
  "results": [
    {
      "id": "resource123",
      "title": "Introduction to Linear Equations",
      "description": "A comprehensive guide to solving linear equations",
      "url": "https://oer.example.com/resources/resource123",
      "subject": "mathematics",
      "grade_level": "8-9",
      "license": "CC-BY"
    }
  ],
  "timestamp": "2025-06-07T10:36:12.123456"
}
```

#### Real-Time Personalized Tutoring

##### `schedule_tutoring_session`

Schedule a session with a real-time personalized tutoring platform.

**Request:**
```json
{
  "platform_url": "https://tutoring.example.com/api",
  "client_id": "your-client-id",
  "client_secret": "your-client-secret",
  "student_id": "student123",
  "subject": "mathematics",
  "datetime_str": "2025-06-10T15:00:00Z"
}
```

**Response:**
```json
{
  "success": true,
  "session_id": "session789",
  "tutor": {
    "id": "tutor456",
    "name": "Dr. Jane Smith",
    "rating": 4.9,
    "specialization": "mathematics"
  },
  "datetime": "2025-06-10T15:00:00Z",
  "join_url": "https://tutoring.example.com/session/session789",
  "timestamp": "2025-06-07T10:37:45.123456"
}
```

## Resources API

Resources represent data that can be fetched by MCP clients. Each resource is accessed via:

```
GET /resources?uri={resource_uri}
Accept: application/json
```

### Available Resources

#### `concept-graph://`

Retrieves the full knowledge concept graph.

#### `learning-path://{student_id}`

Retrieves the personalized learning path for a student.

#### `curriculum-standards://{country_code}`

Retrieves curriculum standards for a specific country.

#### `student-dashboard://{student_id}`

Retrieves dashboard data for a specific student.

## Error Handling

API errors follow a standard format:

```json
{
  "error": {
    "code": "error_code",
    "message": "Human-readable error message",
    "details": {}
  }
}
```

Common error codes:
- `invalid_request`: The request was malformed
- `authentication_error`: Authentication failed
- `not_found`: The requested resource does not exist
- `server_error`: Internal server error

## Rate Limiting

Production deployments implement rate limiting to prevent abuse. Clients should monitor the following headers:

- `X-RateLimit-Limit`: Maximum requests per hour
- `X-RateLimit-Remaining`: Remaining requests for the current hour
- `X-RateLimit-Reset`: Timestamp when the limit will reset

## SDK

For easier integration, we provide client SDKs in multiple languages:

- Python: `pip install tutorx-client`
- JavaScript: `npm install tutorx-client`

Example usage (Python):

```python
from tutorx_client import TutorXClient

client = TutorXClient("http://localhost:8000", api_key="your-api-key")

# Call a tool
result = client.assess_skill("student123", "math_algebra_basics")
print(result["skill_level"])

# Access a resource
concept_graph = client.get_concept_graph()
```

## Webhooks

For real-time updates, you can register webhook endpoints:

```
POST /webhooks/register
Content-Type: application/json
Authorization: Bearer your-api-key

{
  "url": "https://your-app.example.com/webhook",
  "events": ["assessment.completed", "badge.awarded"],
  "secret": "your-webhook-secret"
}
```

## Support

For API support, contact us at [email protected]