Spaces:
Sleeping
Sleeping
Meet Patel
commited on
Commit
·
a806ca2
1
Parent(s):
1af10cc
Refactor TutorX MCP server to integrate Mistral OCR for document processing, update concept graph tools for LLM-driven responses, and enhance learning path generation with Gemini. Transitioned various tools to utilize LLM for improved educational interactions and streamlined API responses.
Browse files- .vscode/PythonImportHelper-v2-Completion.json +2111 -0
- app.py +76 -89
- mcp_server/server.py +34 -13
- mcp_server/tools/__init__.py +2 -3
- mcp_server/tools/concept_graph_tools.py +22 -14
- mcp_server/tools/concept_tools.py +32 -63
- mcp_server/tools/interaction_tools.py +31 -109
- mcp_server/tools/learning_path_tools.py +17 -15
- mcp_server/tools/lesson_tools.py +17 -114
- mcp_server/tools/ocr_tools.py +107 -131
- mcp_server/tools/quiz_tools.py +11 -33
- tests/ocr_app.py +281 -0
- tests/test_tools_integration.py +107 -0
- tests/test_upload_ocr.py +79 -0
.vscode/PythonImportHelper-v2-Completion.json
ADDED
@@ -0,0 +1,2111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"label": "runpy",
|
4 |
+
"kind": 6,
|
5 |
+
"isExtraImport": true,
|
6 |
+
"importPath": "runpy",
|
7 |
+
"description": "runpy",
|
8 |
+
"detail": "runpy",
|
9 |
+
"documentation": {}
|
10 |
+
},
|
11 |
+
{
|
12 |
+
"label": "annotations",
|
13 |
+
"importPath": "__future__",
|
14 |
+
"description": "__future__",
|
15 |
+
"isExtraImport": true,
|
16 |
+
"detail": "__future__",
|
17 |
+
"documentation": {}
|
18 |
+
},
|
19 |
+
{
|
20 |
+
"label": "os",
|
21 |
+
"kind": 6,
|
22 |
+
"isExtraImport": true,
|
23 |
+
"importPath": "os",
|
24 |
+
"description": "os",
|
25 |
+
"detail": "os",
|
26 |
+
"documentation": {}
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"label": "site",
|
30 |
+
"kind": 6,
|
31 |
+
"isExtraImport": true,
|
32 |
+
"importPath": "site",
|
33 |
+
"description": "site",
|
34 |
+
"detail": "site",
|
35 |
+
"documentation": {}
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"label": "sys",
|
39 |
+
"kind": 6,
|
40 |
+
"isExtraImport": true,
|
41 |
+
"importPath": "sys",
|
42 |
+
"description": "sys",
|
43 |
+
"detail": "sys",
|
44 |
+
"documentation": {}
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"label": "zip",
|
48 |
+
"importPath": "builtins",
|
49 |
+
"description": "builtins",
|
50 |
+
"isExtraImport": true,
|
51 |
+
"detail": "builtins",
|
52 |
+
"documentation": {}
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"label": "str",
|
56 |
+
"importPath": "builtins",
|
57 |
+
"description": "builtins",
|
58 |
+
"isExtraImport": true,
|
59 |
+
"detail": "builtins",
|
60 |
+
"documentation": {}
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"label": "os.path",
|
64 |
+
"kind": 6,
|
65 |
+
"isExtraImport": true,
|
66 |
+
"importPath": "os.path",
|
67 |
+
"description": "os.path",
|
68 |
+
"detail": "os.path",
|
69 |
+
"documentation": {}
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"label": "cElementTree",
|
73 |
+
"importPath": "xml.etree",
|
74 |
+
"description": "xml.etree",
|
75 |
+
"isExtraImport": true,
|
76 |
+
"detail": "xml.etree",
|
77 |
+
"documentation": {}
|
78 |
+
},
|
79 |
+
{
|
80 |
+
"label": "pyxnat",
|
81 |
+
"kind": 6,
|
82 |
+
"isExtraImport": true,
|
83 |
+
"importPath": "pyxnat",
|
84 |
+
"description": "pyxnat",
|
85 |
+
"detail": "pyxnat",
|
86 |
+
"documentation": {}
|
87 |
+
},
|
88 |
+
{
|
89 |
+
"label": "google.generativeai",
|
90 |
+
"kind": 6,
|
91 |
+
"isExtraImport": true,
|
92 |
+
"importPath": "google.generativeai",
|
93 |
+
"description": "google.generativeai",
|
94 |
+
"detail": "google.generativeai",
|
95 |
+
"documentation": {}
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"label": "Dict",
|
99 |
+
"importPath": "typing",
|
100 |
+
"description": "typing",
|
101 |
+
"isExtraImport": true,
|
102 |
+
"detail": "typing",
|
103 |
+
"documentation": {}
|
104 |
+
},
|
105 |
+
{
|
106 |
+
"label": "Any",
|
107 |
+
"importPath": "typing",
|
108 |
+
"description": "typing",
|
109 |
+
"isExtraImport": true,
|
110 |
+
"detail": "typing",
|
111 |
+
"documentation": {}
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"label": "Optional",
|
115 |
+
"importPath": "typing",
|
116 |
+
"description": "typing",
|
117 |
+
"isExtraImport": true,
|
118 |
+
"detail": "typing",
|
119 |
+
"documentation": {}
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"label": "List",
|
123 |
+
"importPath": "typing",
|
124 |
+
"description": "typing",
|
125 |
+
"isExtraImport": true,
|
126 |
+
"detail": "typing",
|
127 |
+
"documentation": {}
|
128 |
+
},
|
129 |
+
{
|
130 |
+
"label": "Literal",
|
131 |
+
"importPath": "typing",
|
132 |
+
"description": "typing",
|
133 |
+
"isExtraImport": true,
|
134 |
+
"detail": "typing",
|
135 |
+
"documentation": {}
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"label": "Union",
|
139 |
+
"importPath": "typing",
|
140 |
+
"description": "typing",
|
141 |
+
"isExtraImport": true,
|
142 |
+
"detail": "typing",
|
143 |
+
"documentation": {}
|
144 |
+
},
|
145 |
+
{
|
146 |
+
"label": "TypeVar",
|
147 |
+
"importPath": "typing",
|
148 |
+
"description": "typing",
|
149 |
+
"isExtraImport": true,
|
150 |
+
"detail": "typing",
|
151 |
+
"documentation": {}
|
152 |
+
},
|
153 |
+
{
|
154 |
+
"label": "Callable",
|
155 |
+
"importPath": "typing",
|
156 |
+
"description": "typing",
|
157 |
+
"isExtraImport": true,
|
158 |
+
"detail": "typing",
|
159 |
+
"documentation": {}
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"label": "Dict",
|
163 |
+
"importPath": "typing",
|
164 |
+
"description": "typing",
|
165 |
+
"isExtraImport": true,
|
166 |
+
"detail": "typing",
|
167 |
+
"documentation": {}
|
168 |
+
},
|
169 |
+
{
|
170 |
+
"label": "Any",
|
171 |
+
"importPath": "typing",
|
172 |
+
"description": "typing",
|
173 |
+
"isExtraImport": true,
|
174 |
+
"detail": "typing",
|
175 |
+
"documentation": {}
|
176 |
+
},
|
177 |
+
{
|
178 |
+
"label": "Dict",
|
179 |
+
"importPath": "typing",
|
180 |
+
"description": "typing",
|
181 |
+
"isExtraImport": true,
|
182 |
+
"detail": "typing",
|
183 |
+
"documentation": {}
|
184 |
+
},
|
185 |
+
{
|
186 |
+
"label": "Any",
|
187 |
+
"importPath": "typing",
|
188 |
+
"description": "typing",
|
189 |
+
"isExtraImport": true,
|
190 |
+
"detail": "typing",
|
191 |
+
"documentation": {}
|
192 |
+
},
|
193 |
+
{
|
194 |
+
"label": "Dict",
|
195 |
+
"importPath": "typing",
|
196 |
+
"description": "typing",
|
197 |
+
"isExtraImport": true,
|
198 |
+
"detail": "typing",
|
199 |
+
"documentation": {}
|
200 |
+
},
|
201 |
+
{
|
202 |
+
"label": "Any",
|
203 |
+
"importPath": "typing",
|
204 |
+
"description": "typing",
|
205 |
+
"isExtraImport": true,
|
206 |
+
"detail": "typing",
|
207 |
+
"documentation": {}
|
208 |
+
},
|
209 |
+
{
|
210 |
+
"label": "Optional",
|
211 |
+
"importPath": "typing",
|
212 |
+
"description": "typing",
|
213 |
+
"isExtraImport": true,
|
214 |
+
"detail": "typing",
|
215 |
+
"documentation": {}
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"label": "Dict",
|
219 |
+
"importPath": "typing",
|
220 |
+
"description": "typing",
|
221 |
+
"isExtraImport": true,
|
222 |
+
"detail": "typing",
|
223 |
+
"documentation": {}
|
224 |
+
},
|
225 |
+
{
|
226 |
+
"label": "Any",
|
227 |
+
"importPath": "typing",
|
228 |
+
"description": "typing",
|
229 |
+
"isExtraImport": true,
|
230 |
+
"detail": "typing",
|
231 |
+
"documentation": {}
|
232 |
+
},
|
233 |
+
{
|
234 |
+
"label": "Optional",
|
235 |
+
"importPath": "typing",
|
236 |
+
"description": "typing",
|
237 |
+
"isExtraImport": true,
|
238 |
+
"detail": "typing",
|
239 |
+
"documentation": {}
|
240 |
+
},
|
241 |
+
{
|
242 |
+
"label": "Dict",
|
243 |
+
"importPath": "typing",
|
244 |
+
"description": "typing",
|
245 |
+
"isExtraImport": true,
|
246 |
+
"detail": "typing",
|
247 |
+
"documentation": {}
|
248 |
+
},
|
249 |
+
{
|
250 |
+
"label": "Any",
|
251 |
+
"importPath": "typing",
|
252 |
+
"description": "typing",
|
253 |
+
"isExtraImport": true,
|
254 |
+
"detail": "typing",
|
255 |
+
"documentation": {}
|
256 |
+
},
|
257 |
+
{
|
258 |
+
"label": "List",
|
259 |
+
"importPath": "typing",
|
260 |
+
"description": "typing",
|
261 |
+
"isExtraImport": true,
|
262 |
+
"detail": "typing",
|
263 |
+
"documentation": {}
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"label": "Optional",
|
267 |
+
"importPath": "typing",
|
268 |
+
"description": "typing",
|
269 |
+
"isExtraImport": true,
|
270 |
+
"detail": "typing",
|
271 |
+
"documentation": {}
|
272 |
+
},
|
273 |
+
{
|
274 |
+
"label": "Dict",
|
275 |
+
"importPath": "typing",
|
276 |
+
"description": "typing",
|
277 |
+
"isExtraImport": true,
|
278 |
+
"detail": "typing",
|
279 |
+
"documentation": {}
|
280 |
+
},
|
281 |
+
{
|
282 |
+
"label": "Any",
|
283 |
+
"importPath": "typing",
|
284 |
+
"description": "typing",
|
285 |
+
"isExtraImport": true,
|
286 |
+
"detail": "typing",
|
287 |
+
"documentation": {}
|
288 |
+
},
|
289 |
+
{
|
290 |
+
"label": "List",
|
291 |
+
"importPath": "typing",
|
292 |
+
"description": "typing",
|
293 |
+
"isExtraImport": true,
|
294 |
+
"detail": "typing",
|
295 |
+
"documentation": {}
|
296 |
+
},
|
297 |
+
{
|
298 |
+
"label": "Optional",
|
299 |
+
"importPath": "typing",
|
300 |
+
"description": "typing",
|
301 |
+
"isExtraImport": true,
|
302 |
+
"detail": "typing",
|
303 |
+
"documentation": {}
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"label": "Dict",
|
307 |
+
"importPath": "typing",
|
308 |
+
"description": "typing",
|
309 |
+
"isExtraImport": true,
|
310 |
+
"detail": "typing",
|
311 |
+
"documentation": {}
|
312 |
+
},
|
313 |
+
{
|
314 |
+
"label": "Any",
|
315 |
+
"importPath": "typing",
|
316 |
+
"description": "typing",
|
317 |
+
"isExtraImport": true,
|
318 |
+
"detail": "typing",
|
319 |
+
"documentation": {}
|
320 |
+
},
|
321 |
+
{
|
322 |
+
"label": "List",
|
323 |
+
"importPath": "typing",
|
324 |
+
"description": "typing",
|
325 |
+
"isExtraImport": true,
|
326 |
+
"detail": "typing",
|
327 |
+
"documentation": {}
|
328 |
+
},
|
329 |
+
{
|
330 |
+
"label": "Dict",
|
331 |
+
"importPath": "typing",
|
332 |
+
"description": "typing",
|
333 |
+
"isExtraImport": true,
|
334 |
+
"detail": "typing",
|
335 |
+
"documentation": {}
|
336 |
+
},
|
337 |
+
{
|
338 |
+
"label": "Any",
|
339 |
+
"importPath": "typing",
|
340 |
+
"description": "typing",
|
341 |
+
"isExtraImport": true,
|
342 |
+
"detail": "typing",
|
343 |
+
"documentation": {}
|
344 |
+
},
|
345 |
+
{
|
346 |
+
"label": "Optional",
|
347 |
+
"importPath": "typing",
|
348 |
+
"description": "typing",
|
349 |
+
"isExtraImport": true,
|
350 |
+
"detail": "typing",
|
351 |
+
"documentation": {}
|
352 |
+
},
|
353 |
+
{
|
354 |
+
"label": "Dict",
|
355 |
+
"importPath": "typing",
|
356 |
+
"description": "typing",
|
357 |
+
"isExtraImport": true,
|
358 |
+
"detail": "typing",
|
359 |
+
"documentation": {}
|
360 |
+
},
|
361 |
+
{
|
362 |
+
"label": "Any",
|
363 |
+
"importPath": "typing",
|
364 |
+
"description": "typing",
|
365 |
+
"isExtraImport": true,
|
366 |
+
"detail": "typing",
|
367 |
+
"documentation": {}
|
368 |
+
},
|
369 |
+
{
|
370 |
+
"label": "List",
|
371 |
+
"importPath": "typing",
|
372 |
+
"description": "typing",
|
373 |
+
"isExtraImport": true,
|
374 |
+
"detail": "typing",
|
375 |
+
"documentation": {}
|
376 |
+
},
|
377 |
+
{
|
378 |
+
"label": "Optional",
|
379 |
+
"importPath": "typing",
|
380 |
+
"description": "typing",
|
381 |
+
"isExtraImport": true,
|
382 |
+
"detail": "typing",
|
383 |
+
"documentation": {}
|
384 |
+
},
|
385 |
+
{
|
386 |
+
"label": "wraps",
|
387 |
+
"importPath": "functools",
|
388 |
+
"description": "functools",
|
389 |
+
"isExtraImport": true,
|
390 |
+
"detail": "functools",
|
391 |
+
"documentation": {}
|
392 |
+
},
|
393 |
+
{
|
394 |
+
"label": "logging",
|
395 |
+
"kind": 6,
|
396 |
+
"isExtraImport": true,
|
397 |
+
"importPath": "logging",
|
398 |
+
"description": "logging",
|
399 |
+
"detail": "logging",
|
400 |
+
"documentation": {}
|
401 |
+
},
|
402 |
+
{
|
403 |
+
"label": "Path",
|
404 |
+
"importPath": "pathlib",
|
405 |
+
"description": "pathlib",
|
406 |
+
"isExtraImport": true,
|
407 |
+
"detail": "pathlib",
|
408 |
+
"documentation": {}
|
409 |
+
},
|
410 |
+
{
|
411 |
+
"label": "Path",
|
412 |
+
"importPath": "pathlib",
|
413 |
+
"description": "pathlib",
|
414 |
+
"isExtraImport": true,
|
415 |
+
"detail": "pathlib",
|
416 |
+
"documentation": {}
|
417 |
+
},
|
418 |
+
{
|
419 |
+
"label": "Path",
|
420 |
+
"importPath": "pathlib",
|
421 |
+
"description": "pathlib",
|
422 |
+
"isExtraImport": true,
|
423 |
+
"detail": "pathlib",
|
424 |
+
"documentation": {}
|
425 |
+
},
|
426 |
+
{
|
427 |
+
"label": "Path",
|
428 |
+
"importPath": "pathlib",
|
429 |
+
"description": "pathlib",
|
430 |
+
"isExtraImport": true,
|
431 |
+
"detail": "pathlib",
|
432 |
+
"documentation": {}
|
433 |
+
},
|
434 |
+
{
|
435 |
+
"label": "Path",
|
436 |
+
"importPath": "pathlib",
|
437 |
+
"description": "pathlib",
|
438 |
+
"isExtraImport": true,
|
439 |
+
"detail": "pathlib",
|
440 |
+
"documentation": {}
|
441 |
+
},
|
442 |
+
{
|
443 |
+
"label": "Path",
|
444 |
+
"importPath": "pathlib",
|
445 |
+
"description": "pathlib",
|
446 |
+
"isExtraImport": true,
|
447 |
+
"detail": "pathlib",
|
448 |
+
"documentation": {}
|
449 |
+
},
|
450 |
+
{
|
451 |
+
"label": "Path",
|
452 |
+
"importPath": "pathlib",
|
453 |
+
"description": "pathlib",
|
454 |
+
"isExtraImport": true,
|
455 |
+
"detail": "pathlib",
|
456 |
+
"documentation": {}
|
457 |
+
},
|
458 |
+
{
|
459 |
+
"label": "Path",
|
460 |
+
"importPath": "pathlib",
|
461 |
+
"description": "pathlib",
|
462 |
+
"isExtraImport": true,
|
463 |
+
"detail": "pathlib",
|
464 |
+
"documentation": {}
|
465 |
+
},
|
466 |
+
{
|
467 |
+
"label": "Path",
|
468 |
+
"importPath": "pathlib",
|
469 |
+
"description": "pathlib",
|
470 |
+
"isExtraImport": true,
|
471 |
+
"detail": "pathlib",
|
472 |
+
"documentation": {}
|
473 |
+
},
|
474 |
+
{
|
475 |
+
"label": "json",
|
476 |
+
"kind": 6,
|
477 |
+
"isExtraImport": true,
|
478 |
+
"importPath": "json",
|
479 |
+
"description": "json",
|
480 |
+
"detail": "json",
|
481 |
+
"documentation": {}
|
482 |
+
},
|
483 |
+
{
|
484 |
+
"label": "concept_graph",
|
485 |
+
"importPath": "resources",
|
486 |
+
"description": "resources",
|
487 |
+
"isExtraImport": true,
|
488 |
+
"detail": "resources",
|
489 |
+
"documentation": {}
|
490 |
+
},
|
491 |
+
{
|
492 |
+
"label": "concept_graph",
|
493 |
+
"importPath": "resources",
|
494 |
+
"description": "resources",
|
495 |
+
"isExtraImport": true,
|
496 |
+
"detail": "resources",
|
497 |
+
"documentation": {}
|
498 |
+
},
|
499 |
+
{
|
500 |
+
"label": "curriculum_standards",
|
501 |
+
"importPath": "resources",
|
502 |
+
"description": "resources",
|
503 |
+
"isExtraImport": true,
|
504 |
+
"detail": "resources",
|
505 |
+
"documentation": {}
|
506 |
+
},
|
507 |
+
{
|
508 |
+
"label": "mcp",
|
509 |
+
"importPath": "mcp_server.mcp_instance",
|
510 |
+
"description": "mcp_server.mcp_instance",
|
511 |
+
"isExtraImport": true,
|
512 |
+
"detail": "mcp_server.mcp_instance",
|
513 |
+
"documentation": {}
|
514 |
+
},
|
515 |
+
{
|
516 |
+
"label": "mcp",
|
517 |
+
"importPath": "mcp_server.mcp_instance",
|
518 |
+
"description": "mcp_server.mcp_instance",
|
519 |
+
"isExtraImport": true,
|
520 |
+
"detail": "mcp_server.mcp_instance",
|
521 |
+
"documentation": {}
|
522 |
+
},
|
523 |
+
{
|
524 |
+
"label": "mcp",
|
525 |
+
"importPath": "mcp_server.mcp_instance",
|
526 |
+
"description": "mcp_server.mcp_instance",
|
527 |
+
"isExtraImport": true,
|
528 |
+
"detail": "mcp_server.mcp_instance",
|
529 |
+
"documentation": {}
|
530 |
+
},
|
531 |
+
{
|
532 |
+
"label": "mcp",
|
533 |
+
"importPath": "mcp_server.mcp_instance",
|
534 |
+
"description": "mcp_server.mcp_instance",
|
535 |
+
"isExtraImport": true,
|
536 |
+
"detail": "mcp_server.mcp_instance",
|
537 |
+
"documentation": {}
|
538 |
+
},
|
539 |
+
{
|
540 |
+
"label": "mcp",
|
541 |
+
"importPath": "mcp_server.mcp_instance",
|
542 |
+
"description": "mcp_server.mcp_instance",
|
543 |
+
"isExtraImport": true,
|
544 |
+
"detail": "mcp_server.mcp_instance",
|
545 |
+
"documentation": {}
|
546 |
+
},
|
547 |
+
{
|
548 |
+
"label": "mcp",
|
549 |
+
"importPath": "mcp_server.mcp_instance",
|
550 |
+
"description": "mcp_server.mcp_instance",
|
551 |
+
"isExtraImport": true,
|
552 |
+
"detail": "mcp_server.mcp_instance",
|
553 |
+
"documentation": {}
|
554 |
+
},
|
555 |
+
{
|
556 |
+
"label": "mcp",
|
557 |
+
"importPath": "mcp_server.mcp_instance",
|
558 |
+
"description": "mcp_server.mcp_instance",
|
559 |
+
"isExtraImport": true,
|
560 |
+
"detail": "mcp_server.mcp_instance",
|
561 |
+
"documentation": {}
|
562 |
+
},
|
563 |
+
{
|
564 |
+
"label": "mcp",
|
565 |
+
"importPath": "mcp_server.mcp_instance",
|
566 |
+
"description": "mcp_server.mcp_instance",
|
567 |
+
"isExtraImport": true,
|
568 |
+
"detail": "mcp_server.mcp_instance",
|
569 |
+
"documentation": {}
|
570 |
+
},
|
571 |
+
{
|
572 |
+
"label": "GeminiFlash",
|
573 |
+
"importPath": "mcp_server.model.gemini_flash",
|
574 |
+
"description": "mcp_server.model.gemini_flash",
|
575 |
+
"isExtraImport": true,
|
576 |
+
"detail": "mcp_server.model.gemini_flash",
|
577 |
+
"documentation": {}
|
578 |
+
},
|
579 |
+
{
|
580 |
+
"label": "GeminiFlash",
|
581 |
+
"importPath": "mcp_server.model.gemini_flash",
|
582 |
+
"description": "mcp_server.model.gemini_flash",
|
583 |
+
"isExtraImport": true,
|
584 |
+
"detail": "mcp_server.model.gemini_flash",
|
585 |
+
"documentation": {}
|
586 |
+
},
|
587 |
+
{
|
588 |
+
"label": "GeminiFlash",
|
589 |
+
"importPath": "mcp_server.model.gemini_flash",
|
590 |
+
"description": "mcp_server.model.gemini_flash",
|
591 |
+
"isExtraImport": true,
|
592 |
+
"detail": "mcp_server.model.gemini_flash",
|
593 |
+
"documentation": {}
|
594 |
+
},
|
595 |
+
{
|
596 |
+
"label": "GeminiFlash",
|
597 |
+
"importPath": "mcp_server.model.gemini_flash",
|
598 |
+
"description": "mcp_server.model.gemini_flash",
|
599 |
+
"isExtraImport": true,
|
600 |
+
"detail": "mcp_server.model.gemini_flash",
|
601 |
+
"documentation": {}
|
602 |
+
},
|
603 |
+
{
|
604 |
+
"label": "GeminiFlash",
|
605 |
+
"importPath": "mcp_server.model.gemini_flash",
|
606 |
+
"description": "mcp_server.model.gemini_flash",
|
607 |
+
"isExtraImport": true,
|
608 |
+
"detail": "mcp_server.model.gemini_flash",
|
609 |
+
"documentation": {}
|
610 |
+
},
|
611 |
+
{
|
612 |
+
"label": "GeminiFlash",
|
613 |
+
"importPath": "mcp_server.model.gemini_flash",
|
614 |
+
"description": "mcp_server.model.gemini_flash",
|
615 |
+
"isExtraImport": true,
|
616 |
+
"detail": "mcp_server.model.gemini_flash",
|
617 |
+
"documentation": {}
|
618 |
+
},
|
619 |
+
{
|
620 |
+
"label": "random",
|
621 |
+
"kind": 6,
|
622 |
+
"isExtraImport": true,
|
623 |
+
"importPath": "random",
|
624 |
+
"description": "random",
|
625 |
+
"detail": "random",
|
626 |
+
"documentation": {}
|
627 |
+
},
|
628 |
+
{
|
629 |
+
"label": "datetime",
|
630 |
+
"importPath": "datetime",
|
631 |
+
"description": "datetime",
|
632 |
+
"isExtraImport": true,
|
633 |
+
"detail": "datetime",
|
634 |
+
"documentation": {}
|
635 |
+
},
|
636 |
+
{
|
637 |
+
"label": "timezone",
|
638 |
+
"importPath": "datetime",
|
639 |
+
"description": "datetime",
|
640 |
+
"isExtraImport": true,
|
641 |
+
"detail": "datetime",
|
642 |
+
"documentation": {}
|
643 |
+
},
|
644 |
+
{
|
645 |
+
"label": "datetime",
|
646 |
+
"importPath": "datetime",
|
647 |
+
"description": "datetime",
|
648 |
+
"isExtraImport": true,
|
649 |
+
"detail": "datetime",
|
650 |
+
"documentation": {}
|
651 |
+
},
|
652 |
+
{
|
653 |
+
"label": "timedelta",
|
654 |
+
"importPath": "datetime",
|
655 |
+
"description": "datetime",
|
656 |
+
"isExtraImport": true,
|
657 |
+
"detail": "datetime",
|
658 |
+
"documentation": {}
|
659 |
+
},
|
660 |
+
{
|
661 |
+
"label": "datetime",
|
662 |
+
"importPath": "datetime",
|
663 |
+
"description": "datetime",
|
664 |
+
"isExtraImport": true,
|
665 |
+
"detail": "datetime",
|
666 |
+
"documentation": {}
|
667 |
+
},
|
668 |
+
{
|
669 |
+
"label": "datetime",
|
670 |
+
"importPath": "datetime",
|
671 |
+
"description": "datetime",
|
672 |
+
"isExtraImport": true,
|
673 |
+
"detail": "datetime",
|
674 |
+
"documentation": {}
|
675 |
+
},
|
676 |
+
{
|
677 |
+
"label": "get_concept",
|
678 |
+
"importPath": "resources.concept_graph",
|
679 |
+
"description": "resources.concept_graph",
|
680 |
+
"isExtraImport": true,
|
681 |
+
"detail": "resources.concept_graph",
|
682 |
+
"documentation": {}
|
683 |
+
},
|
684 |
+
{
|
685 |
+
"label": "get_all_concepts",
|
686 |
+
"importPath": "resources.concept_graph",
|
687 |
+
"description": "resources.concept_graph",
|
688 |
+
"isExtraImport": true,
|
689 |
+
"detail": "resources.concept_graph",
|
690 |
+
"documentation": {}
|
691 |
+
},
|
692 |
+
{
|
693 |
+
"label": "CONCEPT_GRAPH",
|
694 |
+
"importPath": "resources.concept_graph",
|
695 |
+
"description": "resources.concept_graph",
|
696 |
+
"isExtraImport": true,
|
697 |
+
"detail": "resources.concept_graph",
|
698 |
+
"documentation": {}
|
699 |
+
},
|
700 |
+
{
|
701 |
+
"label": "re",
|
702 |
+
"kind": 6,
|
703 |
+
"isExtraImport": true,
|
704 |
+
"importPath": "re",
|
705 |
+
"description": "re",
|
706 |
+
"detail": "re",
|
707 |
+
"documentation": {}
|
708 |
+
},
|
709 |
+
{
|
710 |
+
"label": "SequenceMatcher",
|
711 |
+
"importPath": "difflib",
|
712 |
+
"description": "difflib",
|
713 |
+
"isExtraImport": true,
|
714 |
+
"detail": "difflib",
|
715 |
+
"documentation": {}
|
716 |
+
},
|
717 |
+
{
|
718 |
+
"label": "base64",
|
719 |
+
"kind": 6,
|
720 |
+
"isExtraImport": true,
|
721 |
+
"importPath": "base64",
|
722 |
+
"description": "base64",
|
723 |
+
"detail": "base64",
|
724 |
+
"documentation": {}
|
725 |
+
},
|
726 |
+
{
|
727 |
+
"label": "io",
|
728 |
+
"kind": 6,
|
729 |
+
"isExtraImport": true,
|
730 |
+
"importPath": "io",
|
731 |
+
"description": "io",
|
732 |
+
"detail": "io",
|
733 |
+
"documentation": {}
|
734 |
+
},
|
735 |
+
{
|
736 |
+
"label": "asyncio",
|
737 |
+
"kind": 6,
|
738 |
+
"isExtraImport": true,
|
739 |
+
"importPath": "asyncio",
|
740 |
+
"description": "asyncio",
|
741 |
+
"detail": "asyncio",
|
742 |
+
"documentation": {}
|
743 |
+
},
|
744 |
+
{
|
745 |
+
"label": "aiohttp",
|
746 |
+
"kind": 6,
|
747 |
+
"isExtraImport": true,
|
748 |
+
"importPath": "aiohttp",
|
749 |
+
"description": "aiohttp",
|
750 |
+
"detail": "aiohttp",
|
751 |
+
"documentation": {}
|
752 |
+
},
|
753 |
+
{
|
754 |
+
"label": "GeminiFlash",
|
755 |
+
"importPath": "model",
|
756 |
+
"description": "model",
|
757 |
+
"isExtraImport": true,
|
758 |
+
"detail": "model",
|
759 |
+
"documentation": {}
|
760 |
+
},
|
761 |
+
{
|
762 |
+
"label": "uuid",
|
763 |
+
"kind": 6,
|
764 |
+
"isExtraImport": true,
|
765 |
+
"importPath": "uuid",
|
766 |
+
"description": "uuid",
|
767 |
+
"detail": "uuid",
|
768 |
+
"documentation": {}
|
769 |
+
},
|
770 |
+
{
|
771 |
+
"label": "BlobServiceClient",
|
772 |
+
"importPath": "azure.storage.blob",
|
773 |
+
"description": "azure.storage.blob",
|
774 |
+
"isExtraImport": true,
|
775 |
+
"detail": "azure.storage.blob",
|
776 |
+
"documentation": {}
|
777 |
+
},
|
778 |
+
{
|
779 |
+
"label": "ContentSettings",
|
780 |
+
"importPath": "azure.storage.blob",
|
781 |
+
"description": "azure.storage.blob",
|
782 |
+
"isExtraImport": true,
|
783 |
+
"detail": "azure.storage.blob",
|
784 |
+
"documentation": {}
|
785 |
+
},
|
786 |
+
{
|
787 |
+
"label": "BlobServiceClient",
|
788 |
+
"importPath": "azure.storage.blob",
|
789 |
+
"description": "azure.storage.blob",
|
790 |
+
"isExtraImport": true,
|
791 |
+
"detail": "azure.storage.blob",
|
792 |
+
"documentation": {}
|
793 |
+
},
|
794 |
+
{
|
795 |
+
"label": "ContentSettings",
|
796 |
+
"importPath": "azure.storage.blob",
|
797 |
+
"description": "azure.storage.blob",
|
798 |
+
"isExtraImport": true,
|
799 |
+
"detail": "azure.storage.blob",
|
800 |
+
"documentation": {}
|
801 |
+
},
|
802 |
+
{
|
803 |
+
"label": "load_dotenv",
|
804 |
+
"importPath": "dotenv",
|
805 |
+
"description": "dotenv",
|
806 |
+
"isExtraImport": true,
|
807 |
+
"detail": "dotenv",
|
808 |
+
"documentation": {}
|
809 |
+
},
|
810 |
+
{
|
811 |
+
"label": "load_dotenv",
|
812 |
+
"importPath": "dotenv",
|
813 |
+
"description": "dotenv",
|
814 |
+
"isExtraImport": true,
|
815 |
+
"detail": "dotenv",
|
816 |
+
"documentation": {}
|
817 |
+
},
|
818 |
+
{
|
819 |
+
"label": "FastMCP",
|
820 |
+
"importPath": "mcp.server.fastmcp",
|
821 |
+
"description": "mcp.server.fastmcp",
|
822 |
+
"isExtraImport": true,
|
823 |
+
"detail": "mcp.server.fastmcp",
|
824 |
+
"documentation": {}
|
825 |
+
},
|
826 |
+
{
|
827 |
+
"label": "FastMCP",
|
828 |
+
"importPath": "mcp.server.fastmcp",
|
829 |
+
"description": "mcp.server.fastmcp",
|
830 |
+
"isExtraImport": true,
|
831 |
+
"detail": "mcp.server.fastmcp",
|
832 |
+
"documentation": {}
|
833 |
+
},
|
834 |
+
{
|
835 |
+
"label": "uvicorn",
|
836 |
+
"kind": 6,
|
837 |
+
"isExtraImport": true,
|
838 |
+
"importPath": "uvicorn",
|
839 |
+
"description": "uvicorn",
|
840 |
+
"detail": "uvicorn",
|
841 |
+
"documentation": {}
|
842 |
+
},
|
843 |
+
{
|
844 |
+
"label": "FastAPI",
|
845 |
+
"importPath": "fastapi",
|
846 |
+
"description": "fastapi",
|
847 |
+
"isExtraImport": true,
|
848 |
+
"detail": "fastapi",
|
849 |
+
"documentation": {}
|
850 |
+
},
|
851 |
+
{
|
852 |
+
"label": "HTTPException",
|
853 |
+
"importPath": "fastapi",
|
854 |
+
"description": "fastapi",
|
855 |
+
"isExtraImport": true,
|
856 |
+
"detail": "fastapi",
|
857 |
+
"documentation": {}
|
858 |
+
},
|
859 |
+
{
|
860 |
+
"label": "UploadFile",
|
861 |
+
"importPath": "fastapi",
|
862 |
+
"description": "fastapi",
|
863 |
+
"isExtraImport": true,
|
864 |
+
"detail": "fastapi",
|
865 |
+
"documentation": {}
|
866 |
+
},
|
867 |
+
{
|
868 |
+
"label": "File",
|
869 |
+
"importPath": "fastapi",
|
870 |
+
"description": "fastapi",
|
871 |
+
"isExtraImport": true,
|
872 |
+
"detail": "fastapi",
|
873 |
+
"documentation": {}
|
874 |
+
},
|
875 |
+
{
|
876 |
+
"label": "Form",
|
877 |
+
"importPath": "fastapi",
|
878 |
+
"description": "fastapi",
|
879 |
+
"isExtraImport": true,
|
880 |
+
"detail": "fastapi",
|
881 |
+
"documentation": {}
|
882 |
+
},
|
883 |
+
{
|
884 |
+
"label": "CORSMiddleware",
|
885 |
+
"importPath": "fastapi.middleware.cors",
|
886 |
+
"description": "fastapi.middleware.cors",
|
887 |
+
"isExtraImport": true,
|
888 |
+
"detail": "fastapi.middleware.cors",
|
889 |
+
"documentation": {}
|
890 |
+
},
|
891 |
+
{
|
892 |
+
"label": "concept_tools",
|
893 |
+
"importPath": "tools",
|
894 |
+
"description": "tools",
|
895 |
+
"isExtraImport": true,
|
896 |
+
"detail": "tools",
|
897 |
+
"documentation": {}
|
898 |
+
},
|
899 |
+
{
|
900 |
+
"label": "lesson_tools",
|
901 |
+
"importPath": "tools",
|
902 |
+
"description": "tools",
|
903 |
+
"isExtraImport": true,
|
904 |
+
"detail": "tools",
|
905 |
+
"documentation": {}
|
906 |
+
},
|
907 |
+
{
|
908 |
+
"label": "quiz_tools",
|
909 |
+
"importPath": "tools",
|
910 |
+
"description": "tools",
|
911 |
+
"isExtraImport": true,
|
912 |
+
"detail": "tools",
|
913 |
+
"documentation": {}
|
914 |
+
},
|
915 |
+
{
|
916 |
+
"label": "interaction_tools",
|
917 |
+
"importPath": "tools",
|
918 |
+
"description": "tools",
|
919 |
+
"isExtraImport": true,
|
920 |
+
"detail": "tools",
|
921 |
+
"documentation": {}
|
922 |
+
},
|
923 |
+
{
|
924 |
+
"label": "ocr_tools",
|
925 |
+
"importPath": "tools",
|
926 |
+
"description": "tools",
|
927 |
+
"isExtraImport": true,
|
928 |
+
"detail": "tools",
|
929 |
+
"documentation": {}
|
930 |
+
},
|
931 |
+
{
|
932 |
+
"label": "learning_path_tools",
|
933 |
+
"importPath": "tools",
|
934 |
+
"description": "tools",
|
935 |
+
"isExtraImport": true,
|
936 |
+
"detail": "tools",
|
937 |
+
"documentation": {}
|
938 |
+
},
|
939 |
+
{
|
940 |
+
"label": "concept_tools",
|
941 |
+
"importPath": "mcp_server.tools",
|
942 |
+
"description": "mcp_server.tools",
|
943 |
+
"isExtraImport": true,
|
944 |
+
"detail": "mcp_server.tools",
|
945 |
+
"documentation": {}
|
946 |
+
},
|
947 |
+
{
|
948 |
+
"label": "lesson_tools",
|
949 |
+
"importPath": "mcp_server.tools",
|
950 |
+
"description": "mcp_server.tools",
|
951 |
+
"isExtraImport": true,
|
952 |
+
"detail": "mcp_server.tools",
|
953 |
+
"documentation": {}
|
954 |
+
},
|
955 |
+
{
|
956 |
+
"label": "quiz_tools",
|
957 |
+
"importPath": "mcp_server.tools",
|
958 |
+
"description": "mcp_server.tools",
|
959 |
+
"isExtraImport": true,
|
960 |
+
"detail": "mcp_server.tools",
|
961 |
+
"documentation": {}
|
962 |
+
},
|
963 |
+
{
|
964 |
+
"label": "interaction_tools",
|
965 |
+
"importPath": "mcp_server.tools",
|
966 |
+
"description": "mcp_server.tools",
|
967 |
+
"isExtraImport": true,
|
968 |
+
"detail": "mcp_server.tools",
|
969 |
+
"documentation": {}
|
970 |
+
},
|
971 |
+
{
|
972 |
+
"label": "ocr_tools",
|
973 |
+
"importPath": "mcp_server.tools",
|
974 |
+
"description": "mcp_server.tools",
|
975 |
+
"isExtraImport": true,
|
976 |
+
"detail": "mcp_server.tools",
|
977 |
+
"documentation": {}
|
978 |
+
},
|
979 |
+
{
|
980 |
+
"label": "learning_path_tools",
|
981 |
+
"importPath": "mcp_server.tools",
|
982 |
+
"description": "mcp_server.tools",
|
983 |
+
"isExtraImport": true,
|
984 |
+
"detail": "mcp_server.tools",
|
985 |
+
"documentation": {}
|
986 |
+
},
|
987 |
+
{
|
988 |
+
"label": "concept_graph_tools",
|
989 |
+
"importPath": "mcp_server.tools",
|
990 |
+
"description": "mcp_server.tools",
|
991 |
+
"isExtraImport": true,
|
992 |
+
"detail": "mcp_server.tools",
|
993 |
+
"documentation": {}
|
994 |
+
},
|
995 |
+
{
|
996 |
+
"label": "assess_skill_tool",
|
997 |
+
"importPath": "tools.concept_tools",
|
998 |
+
"description": "tools.concept_tools",
|
999 |
+
"isExtraImport": true,
|
1000 |
+
"detail": "tools.concept_tools",
|
1001 |
+
"documentation": {}
|
1002 |
+
},
|
1003 |
+
{
|
1004 |
+
"label": "generate_lesson_tool",
|
1005 |
+
"importPath": "tools.lesson_tools",
|
1006 |
+
"description": "tools.lesson_tools",
|
1007 |
+
"isExtraImport": true,
|
1008 |
+
"detail": "tools.lesson_tools",
|
1009 |
+
"documentation": {}
|
1010 |
+
},
|
1011 |
+
{
|
1012 |
+
"label": "generate_quiz_tool",
|
1013 |
+
"importPath": "tools.quiz_tools",
|
1014 |
+
"description": "tools.quiz_tools",
|
1015 |
+
"isExtraImport": true,
|
1016 |
+
"detail": "tools.quiz_tools",
|
1017 |
+
"documentation": {}
|
1018 |
+
},
|
1019 |
+
{
|
1020 |
+
"label": "setup",
|
1021 |
+
"importPath": "setuptools",
|
1022 |
+
"description": "setuptools",
|
1023 |
+
"isExtraImport": true,
|
1024 |
+
"detail": "setuptools",
|
1025 |
+
"documentation": {}
|
1026 |
+
},
|
1027 |
+
{
|
1028 |
+
"label": "find_packages",
|
1029 |
+
"importPath": "setuptools",
|
1030 |
+
"description": "setuptools",
|
1031 |
+
"isExtraImport": true,
|
1032 |
+
"detail": "setuptools",
|
1033 |
+
"documentation": {}
|
1034 |
+
},
|
1035 |
+
{
|
1036 |
+
"label": "unittest",
|
1037 |
+
"kind": 6,
|
1038 |
+
"isExtraImport": true,
|
1039 |
+
"importPath": "unittest",
|
1040 |
+
"description": "unittest",
|
1041 |
+
"detail": "unittest",
|
1042 |
+
"documentation": {}
|
1043 |
+
},
|
1044 |
+
{
|
1045 |
+
"label": "patch",
|
1046 |
+
"importPath": "unittest.mock",
|
1047 |
+
"description": "unittest.mock",
|
1048 |
+
"isExtraImport": true,
|
1049 |
+
"detail": "unittest.mock",
|
1050 |
+
"documentation": {}
|
1051 |
+
},
|
1052 |
+
{
|
1053 |
+
"label": "MagicMock",
|
1054 |
+
"importPath": "unittest.mock",
|
1055 |
+
"description": "unittest.mock",
|
1056 |
+
"isExtraImport": true,
|
1057 |
+
"detail": "unittest.mock",
|
1058 |
+
"documentation": {}
|
1059 |
+
},
|
1060 |
+
{
|
1061 |
+
"label": "patch",
|
1062 |
+
"importPath": "unittest.mock",
|
1063 |
+
"description": "unittest.mock",
|
1064 |
+
"isExtraImport": true,
|
1065 |
+
"detail": "unittest.mock",
|
1066 |
+
"documentation": {}
|
1067 |
+
},
|
1068 |
+
{
|
1069 |
+
"label": "MagicMock",
|
1070 |
+
"importPath": "unittest.mock",
|
1071 |
+
"description": "unittest.mock",
|
1072 |
+
"isExtraImport": true,
|
1073 |
+
"detail": "unittest.mock",
|
1074 |
+
"documentation": {}
|
1075 |
+
},
|
1076 |
+
{
|
1077 |
+
"label": "patch",
|
1078 |
+
"importPath": "unittest.mock",
|
1079 |
+
"description": "unittest.mock",
|
1080 |
+
"isExtraImport": true,
|
1081 |
+
"detail": "unittest.mock",
|
1082 |
+
"documentation": {}
|
1083 |
+
},
|
1084 |
+
{
|
1085 |
+
"label": "MagicMock",
|
1086 |
+
"importPath": "unittest.mock",
|
1087 |
+
"description": "unittest.mock",
|
1088 |
+
"isExtraImport": true,
|
1089 |
+
"detail": "unittest.mock",
|
1090 |
+
"documentation": {}
|
1091 |
+
},
|
1092 |
+
{
|
1093 |
+
"label": "requests",
|
1094 |
+
"kind": 6,
|
1095 |
+
"isExtraImport": true,
|
1096 |
+
"importPath": "requests",
|
1097 |
+
"description": "requests",
|
1098 |
+
"detail": "requests",
|
1099 |
+
"documentation": {}
|
1100 |
+
},
|
1101 |
+
{
|
1102 |
+
"label": "TutorXClient",
|
1103 |
+
"importPath": "client",
|
1104 |
+
"description": "client",
|
1105 |
+
"isExtraImport": true,
|
1106 |
+
"detail": "client",
|
1107 |
+
"documentation": {}
|
1108 |
+
},
|
1109 |
+
{
|
1110 |
+
"label": "assess_skill",
|
1111 |
+
"importPath": "main",
|
1112 |
+
"description": "main",
|
1113 |
+
"isExtraImport": true,
|
1114 |
+
"detail": "main",
|
1115 |
+
"documentation": {}
|
1116 |
+
},
|
1117 |
+
{
|
1118 |
+
"label": "generate_quiz",
|
1119 |
+
"importPath": "main",
|
1120 |
+
"description": "main",
|
1121 |
+
"isExtraImport": true,
|
1122 |
+
"detail": "main",
|
1123 |
+
"documentation": {}
|
1124 |
+
},
|
1125 |
+
{
|
1126 |
+
"label": "get_concept_graph",
|
1127 |
+
"importPath": "main",
|
1128 |
+
"description": "main",
|
1129 |
+
"isExtraImport": true,
|
1130 |
+
"detail": "main",
|
1131 |
+
"documentation": {}
|
1132 |
+
},
|
1133 |
+
{
|
1134 |
+
"label": "pytest",
|
1135 |
+
"kind": 6,
|
1136 |
+
"isExtraImport": true,
|
1137 |
+
"importPath": "pytest",
|
1138 |
+
"description": "pytest",
|
1139 |
+
"detail": "pytest",
|
1140 |
+
"documentation": {}
|
1141 |
+
},
|
1142 |
+
{
|
1143 |
+
"label": "ClientSession",
|
1144 |
+
"importPath": "mcp",
|
1145 |
+
"description": "mcp",
|
1146 |
+
"isExtraImport": true,
|
1147 |
+
"detail": "mcp",
|
1148 |
+
"documentation": {}
|
1149 |
+
},
|
1150 |
+
{
|
1151 |
+
"label": "ClientSession",
|
1152 |
+
"importPath": "mcp",
|
1153 |
+
"description": "mcp",
|
1154 |
+
"isExtraImport": true,
|
1155 |
+
"detail": "mcp",
|
1156 |
+
"documentation": {}
|
1157 |
+
},
|
1158 |
+
{
|
1159 |
+
"label": "sse_client",
|
1160 |
+
"importPath": "mcp.client.sse",
|
1161 |
+
"description": "mcp.client.sse",
|
1162 |
+
"isExtraImport": true,
|
1163 |
+
"detail": "mcp.client.sse",
|
1164 |
+
"documentation": {}
|
1165 |
+
},
|
1166 |
+
{
|
1167 |
+
"label": "sse_client",
|
1168 |
+
"importPath": "mcp.client.sse",
|
1169 |
+
"description": "mcp.client.sse",
|
1170 |
+
"isExtraImport": true,
|
1171 |
+
"detail": "mcp.client.sse",
|
1172 |
+
"documentation": {}
|
1173 |
+
},
|
1174 |
+
{
|
1175 |
+
"label": "process_text_query",
|
1176 |
+
"importPath": "utils.multimodal",
|
1177 |
+
"description": "utils.multimodal",
|
1178 |
+
"isExtraImport": true,
|
1179 |
+
"detail": "utils.multimodal",
|
1180 |
+
"documentation": {}
|
1181 |
+
},
|
1182 |
+
{
|
1183 |
+
"label": "process_voice_input",
|
1184 |
+
"importPath": "utils.multimodal",
|
1185 |
+
"description": "utils.multimodal",
|
1186 |
+
"isExtraImport": true,
|
1187 |
+
"detail": "utils.multimodal",
|
1188 |
+
"documentation": {}
|
1189 |
+
},
|
1190 |
+
{
|
1191 |
+
"label": "process_handwriting",
|
1192 |
+
"importPath": "utils.multimodal",
|
1193 |
+
"description": "utils.multimodal",
|
1194 |
+
"isExtraImport": true,
|
1195 |
+
"detail": "utils.multimodal",
|
1196 |
+
"documentation": {}
|
1197 |
+
},
|
1198 |
+
{
|
1199 |
+
"label": "generate_question",
|
1200 |
+
"importPath": "utils.assessment",
|
1201 |
+
"description": "utils.assessment",
|
1202 |
+
"isExtraImport": true,
|
1203 |
+
"detail": "utils.assessment",
|
1204 |
+
"documentation": {}
|
1205 |
+
},
|
1206 |
+
{
|
1207 |
+
"label": "evaluate_student_answer",
|
1208 |
+
"importPath": "utils.assessment",
|
1209 |
+
"description": "utils.assessment",
|
1210 |
+
"isExtraImport": true,
|
1211 |
+
"detail": "utils.assessment",
|
1212 |
+
"documentation": {}
|
1213 |
+
},
|
1214 |
+
{
|
1215 |
+
"label": "gradio",
|
1216 |
+
"kind": 6,
|
1217 |
+
"isExtraImport": true,
|
1218 |
+
"importPath": "gradio",
|
1219 |
+
"description": "gradio",
|
1220 |
+
"detail": "gradio",
|
1221 |
+
"documentation": {}
|
1222 |
+
},
|
1223 |
+
{
|
1224 |
+
"label": "numpy",
|
1225 |
+
"kind": 6,
|
1226 |
+
"isExtraImport": true,
|
1227 |
+
"importPath": "numpy",
|
1228 |
+
"description": "numpy",
|
1229 |
+
"detail": "numpy",
|
1230 |
+
"documentation": {}
|
1231 |
+
},
|
1232 |
+
{
|
1233 |
+
"label": "sseclient",
|
1234 |
+
"kind": 6,
|
1235 |
+
"isExtraImport": true,
|
1236 |
+
"importPath": "sseclient",
|
1237 |
+
"description": "sseclient",
|
1238 |
+
"detail": "sseclient",
|
1239 |
+
"documentation": {}
|
1240 |
+
},
|
1241 |
+
{
|
1242 |
+
"label": "upload_to_azure",
|
1243 |
+
"importPath": "mcp_server.utils.azure_upload",
|
1244 |
+
"description": "mcp_server.utils.azure_upload",
|
1245 |
+
"isExtraImport": true,
|
1246 |
+
"detail": "mcp_server.utils.azure_upload",
|
1247 |
+
"documentation": {}
|
1248 |
+
},
|
1249 |
+
{
|
1250 |
+
"label": "api_app",
|
1251 |
+
"importPath": "mcp_server",
|
1252 |
+
"description": "mcp_server",
|
1253 |
+
"isExtraImport": true,
|
1254 |
+
"detail": "mcp_server",
|
1255 |
+
"documentation": {}
|
1256 |
+
},
|
1257 |
+
{
|
1258 |
+
"label": "mcp",
|
1259 |
+
"importPath": "mcp_server",
|
1260 |
+
"description": "mcp_server",
|
1261 |
+
"isExtraImport": true,
|
1262 |
+
"detail": "mcp_server",
|
1263 |
+
"documentation": {}
|
1264 |
+
},
|
1265 |
+
{
|
1266 |
+
"label": "argparse",
|
1267 |
+
"kind": 6,
|
1268 |
+
"isExtraImport": true,
|
1269 |
+
"importPath": "argparse",
|
1270 |
+
"description": "argparse",
|
1271 |
+
"detail": "argparse",
|
1272 |
+
"documentation": {}
|
1273 |
+
},
|
1274 |
+
{
|
1275 |
+
"label": "socket",
|
1276 |
+
"kind": 6,
|
1277 |
+
"isExtraImport": true,
|
1278 |
+
"importPath": "socket",
|
1279 |
+
"description": "socket",
|
1280 |
+
"detail": "socket",
|
1281 |
+
"documentation": {}
|
1282 |
+
},
|
1283 |
+
{
|
1284 |
+
"label": "bin_dir",
|
1285 |
+
"kind": 5,
|
1286 |
+
"importPath": ".venv.Scripts.activate_this",
|
1287 |
+
"description": ".venv.Scripts.activate_this",
|
1288 |
+
"peekOfCode": "bin_dir = os.path.dirname(abs_file)\nbase = bin_dir[: -len(\"Scripts\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"tutorx-mcp\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))",
|
1289 |
+
"detail": ".venv.Scripts.activate_this",
|
1290 |
+
"documentation": {}
|
1291 |
+
},
|
1292 |
+
{
|
1293 |
+
"label": "base",
|
1294 |
+
"kind": 5,
|
1295 |
+
"importPath": ".venv.Scripts.activate_this",
|
1296 |
+
"description": ".venv.Scripts.activate_this",
|
1297 |
+
"peekOfCode": "base = bin_dir[: -len(\"Scripts\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"tutorx-mcp\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)",
|
1298 |
+
"detail": ".venv.Scripts.activate_this",
|
1299 |
+
"documentation": {}
|
1300 |
+
},
|
1301 |
+
{
|
1302 |
+
"label": "os.environ[\"PATH\"]",
|
1303 |
+
"kind": 5,
|
1304 |
+
"importPath": ".venv.Scripts.activate_this",
|
1305 |
+
"description": ".venv.Scripts.activate_this",
|
1306 |
+
"peekOfCode": "os.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"tutorx-mcp\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix",
|
1307 |
+
"detail": ".venv.Scripts.activate_this",
|
1308 |
+
"documentation": {}
|
1309 |
+
},
|
1310 |
+
{
|
1311 |
+
"label": "os.environ[\"VIRTUAL_ENV\"]",
|
1312 |
+
"kind": 5,
|
1313 |
+
"importPath": ".venv.Scripts.activate_this",
|
1314 |
+
"description": ".venv.Scripts.activate_this",
|
1315 |
+
"peekOfCode": "os.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"tutorx-mcp\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
1316 |
+
"detail": ".venv.Scripts.activate_this",
|
1317 |
+
"documentation": {}
|
1318 |
+
},
|
1319 |
+
{
|
1320 |
+
"label": "os.environ[\"VIRTUAL_ENV_PROMPT\"]",
|
1321 |
+
"kind": 5,
|
1322 |
+
"importPath": ".venv.Scripts.activate_this",
|
1323 |
+
"description": ".venv.Scripts.activate_this",
|
1324 |
+
"peekOfCode": "os.environ[\"VIRTUAL_ENV_PROMPT\"] = \"tutorx-mcp\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
1325 |
+
"detail": ".venv.Scripts.activate_this",
|
1326 |
+
"documentation": {}
|
1327 |
+
},
|
1328 |
+
{
|
1329 |
+
"label": "prev_length",
|
1330 |
+
"kind": 5,
|
1331 |
+
"importPath": ".venv.Scripts.activate_this",
|
1332 |
+
"description": ".venv.Scripts.activate_this",
|
1333 |
+
"peekOfCode": "prev_length = len(sys.path)\nfor lib in \"..\\\\Lib\\\\site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
1334 |
+
"detail": ".venv.Scripts.activate_this",
|
1335 |
+
"documentation": {}
|
1336 |
+
},
|
1337 |
+
{
|
1338 |
+
"label": "sys.path[:]",
|
1339 |
+
"kind": 5,
|
1340 |
+
"importPath": ".venv.Scripts.activate_this",
|
1341 |
+
"description": ".venv.Scripts.activate_this",
|
1342 |
+
"peekOfCode": "sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
|
1343 |
+
"detail": ".venv.Scripts.activate_this",
|
1344 |
+
"documentation": {}
|
1345 |
+
},
|
1346 |
+
{
|
1347 |
+
"label": "sys.real_prefix",
|
1348 |
+
"kind": 5,
|
1349 |
+
"importPath": ".venv.Scripts.activate_this",
|
1350 |
+
"description": ".venv.Scripts.activate_this",
|
1351 |
+
"peekOfCode": "sys.real_prefix = sys.prefix\nsys.prefix = base",
|
1352 |
+
"detail": ".venv.Scripts.activate_this",
|
1353 |
+
"documentation": {}
|
1354 |
+
},
|
1355 |
+
{
|
1356 |
+
"label": "sys.prefix",
|
1357 |
+
"kind": 5,
|
1358 |
+
"importPath": ".venv.Scripts.activate_this",
|
1359 |
+
"description": ".venv.Scripts.activate_this",
|
1360 |
+
"peekOfCode": "sys.prefix = base",
|
1361 |
+
"detail": ".venv.Scripts.activate_this",
|
1362 |
+
"documentation": {}
|
1363 |
+
},
|
1364 |
+
{
|
1365 |
+
"label": "cmp",
|
1366 |
+
"kind": 2,
|
1367 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1368 |
+
"description": ".venv.Scripts.sessionmirror",
|
1369 |
+
"peekOfCode": "def cmp(a, b):\n return (a > b) - (a < b)\nfrom builtins import zip\nfrom builtins import str\nimport os\nimport os.path as op\nimport sys\nfrom xml.etree import cElementTree as ET\nimport pyxnat\nPROJ_ATTRS = [",
|
1370 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1371 |
+
"documentation": {}
|
1372 |
+
},
|
1373 |
+
{
|
1374 |
+
"label": "copy_attrs",
|
1375 |
+
"kind": 2,
|
1376 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1377 |
+
"description": ".venv.Scripts.sessionmirror",
|
1378 |
+
"peekOfCode": "def copy_attrs(src_obj, dest_obj, attr_list):\n \"\"\" Copies list of attributes form source to destination\"\"\"\n src_attrs = src_obj.attrs.mget(attr_list)\n src_list = dict(list(zip(attr_list, src_attrs)))\n # NOTE: For some reason need to set te again b/c a bug somewhere sets te\n # to sequence name\n te_key = 'xnat:mrScanData/parameters/te'\n if te_key in src_list:\n src_list[te_key] = src_obj.attrs.get(te_key)\n dest_obj.attrs.mset(src_list)",
|
1379 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1380 |
+
"documentation": {}
|
1381 |
+
},
|
1382 |
+
{
|
1383 |
+
"label": "copy_attributes",
|
1384 |
+
"kind": 2,
|
1385 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1386 |
+
"description": ".venv.Scripts.sessionmirror",
|
1387 |
+
"peekOfCode": "def copy_attributes(src_obj, dest_obj):\n '''Copy attributes from src to dest'''\n src_type = src_obj.datatype()\n types = {'xnat:projectData': PROJ_ATTRS,\n 'xnat:subjectData': SUBJ_ATTRS,\n 'xnat:mrSessionData': MR_EXP_ATTRS,\n 'xnat:petSessionData': PET_EXP_ATTRS,\n 'xnat:ctSessionData': CT_EXP_ATTRS,\n 'xnat:mrScanData': MR_SCAN_ATTRS,\n 'xnat:petScanData': PET_SCAN_ATTRS,",
|
1388 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1389 |
+
"documentation": {}
|
1390 |
+
},
|
1391 |
+
{
|
1392 |
+
"label": "subj_compare",
|
1393 |
+
"kind": 2,
|
1394 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1395 |
+
"description": ".venv.Scripts.sessionmirror",
|
1396 |
+
"peekOfCode": "def subj_compare(item1, item2):\n '''Compare sort of items'''\n return cmp(item1.label(), item2.label())\ndef copy_file(src_f, dest_r, cache_d):\n '''\n Copy file from XNAT file source to XNAT resource destination,\n using local cache in between'''\n f_label = src_f.label()\n loc_f = cache_d + '/' + f_label\n # Make subdirectories",
|
1397 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1398 |
+
"documentation": {}
|
1399 |
+
},
|
1400 |
+
{
|
1401 |
+
"label": "copy_file",
|
1402 |
+
"kind": 2,
|
1403 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1404 |
+
"description": ".venv.Scripts.sessionmirror",
|
1405 |
+
"peekOfCode": "def copy_file(src_f, dest_r, cache_d):\n '''\n Copy file from XNAT file source to XNAT resource destination,\n using local cache in between'''\n f_label = src_f.label()\n loc_f = cache_d + '/' + f_label\n # Make subdirectories\n loc_d = op.dirname(loc_f)\n if not op.exists(loc_d):\n os.makedirs(loc_d)",
|
1406 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1407 |
+
"documentation": {}
|
1408 |
+
},
|
1409 |
+
{
|
1410 |
+
"label": "copy_res_zip",
|
1411 |
+
"kind": 2,
|
1412 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1413 |
+
"description": ".venv.Scripts.sessionmirror",
|
1414 |
+
"peekOfCode": "def copy_res_zip(src_r, dest_r, cache_d):\n '''\n Copy a resource from XNAT source to XNAT destination using local cache\n in between\n '''\n try:\n # Download zip of resource\n print('INFO:Downloading resource as zip...')\n cache_z = src_r.get(cache_d, extract=False)\n # Upload zip of resource",
|
1415 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1416 |
+
"documentation": {}
|
1417 |
+
},
|
1418 |
+
{
|
1419 |
+
"label": "is_empty_resource",
|
1420 |
+
"kind": 2,
|
1421 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1422 |
+
"description": ".venv.Scripts.sessionmirror",
|
1423 |
+
"peekOfCode": "def is_empty_resource(_res):\n '''Check if resource contains any files'''\n f_count = 0\n for f_in in _res.files().fetchall('obj'):\n f_count += 1\n break\n return f_count == 0\n# copy_project and copy_subject are untested\n# def copy_project(src_proj, dst_proj, proj_cache_dir):\n# '''Copy XNAT project from source to destination'''",
|
1424 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1425 |
+
"documentation": {}
|
1426 |
+
},
|
1427 |
+
{
|
1428 |
+
"label": "copy_session",
|
1429 |
+
"kind": 2,
|
1430 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1431 |
+
"description": ".venv.Scripts.sessionmirror",
|
1432 |
+
"peekOfCode": "def copy_session(src_sess, dst_sess, sess_cache_dir):\n '''Copy XNAT session from source to destination'''\n print('INFO:uploading session attributes as xml')\n # Write xml to file\n if not op.exists(sess_cache_dir):\n os.makedirs(sess_cache_dir)\n sess_xml = src_sess.get()\n xml_path = op.join(sess_cache_dir, 'sess.xml')\n write_xml(sess_xml, xml_path)\n sess_type = src_sess.datatype()",
|
1433 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1434 |
+
"documentation": {}
|
1435 |
+
},
|
1436 |
+
{
|
1437 |
+
"label": "copy_scan",
|
1438 |
+
"kind": 2,
|
1439 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1440 |
+
"description": ".venv.Scripts.sessionmirror",
|
1441 |
+
"peekOfCode": "def copy_scan(src_scan, dst_scan, scan_cache_dir):\n '''Copy scan from source XNAT to destination XNAT'''\n scan_type = src_scan.datatype()\n if scan_type == '':\n scan_type = 'xnat:otherDicomScanData'\n dst_scan.create(scans=scan_type)\n copy_attributes(src_scan, dst_scan)\n # Process each resource of scan\n for src_res in src_scan.resources().fetchall('obj'):\n res_label = src_res.label()",
|
1442 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1443 |
+
"documentation": {}
|
1444 |
+
},
|
1445 |
+
{
|
1446 |
+
"label": "copy_res",
|
1447 |
+
"kind": 2,
|
1448 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1449 |
+
"description": ".venv.Scripts.sessionmirror",
|
1450 |
+
"peekOfCode": "def copy_res(src_res, dst_res, res_cache_dir, use_zip=False):\n '''Copy resource from source XNAT to destination XNAT'''\n # Create cache dir\n if not op.exists(res_cache_dir):\n os.makedirs(res_cache_dir)\n # Prepare resource and check for empty\n is_empty = False\n print(dst_res._uri)\n if not dst_res.exists():\n dst_res.create()",
|
1451 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1452 |
+
"documentation": {}
|
1453 |
+
},
|
1454 |
+
{
|
1455 |
+
"label": "write_xml",
|
1456 |
+
"kind": 2,
|
1457 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1458 |
+
"description": ".venv.Scripts.sessionmirror",
|
1459 |
+
"peekOfCode": "def write_xml(xml_str, file_path, clean_tags=True):\n \"\"\"Writing XML.\"\"\"\n root = ET.fromstring(xml_str)\n # We only want the tags and attributes relevant to root, no children\n if clean_tags:\n # Remove ID\n if 'ID' in root.attrib:\n del root.attrib['ID']\n # Remove sharing tags\n tag = '{http://nrg.wustl.edu/xnat}sharing'",
|
1460 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1461 |
+
"documentation": {}
|
1462 |
+
},
|
1463 |
+
{
|
1464 |
+
"label": "create_parser",
|
1465 |
+
"kind": 2,
|
1466 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1467 |
+
"description": ".venv.Scripts.sessionmirror",
|
1468 |
+
"peekOfCode": "def create_parser():\n import argparse\n \"\"\"Parse commandline arguments.\"\"\"\n arg_parser = argparse.ArgumentParser(\n description='Downloads a given experiment/session from an XNAT instance '\n 'and uploads it to an independent one. Only DICOM resources '\n 'will be imported.',\n formatter_class=argparse.RawTextHelpFormatter)\n arg_parser.add_argument(\n '--h1', '--source_config', dest='source_config',",
|
1469 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1470 |
+
"documentation": {}
|
1471 |
+
},
|
1472 |
+
{
|
1473 |
+
"label": "main",
|
1474 |
+
"kind": 2,
|
1475 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1476 |
+
"description": ".venv.Scripts.sessionmirror",
|
1477 |
+
"peekOfCode": "def main(args):\n x1 = pyxnat.Interface(config=args.source_config)\n x2 = pyxnat.Interface(config=args.dest_config)\n columns = ['subject_label', 'label']\n e1 = x1.array.experiments(experiment_id=args.experiment_id,\n columns=columns).data[0]\n p = x2.select.project(args.project_id)\n s = p.subject(e1['subject_label'])\n if not s.exists():\n s.create()",
|
1478 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1479 |
+
"documentation": {}
|
1480 |
+
},
|
1481 |
+
{
|
1482 |
+
"label": "PROJ_ATTRS",
|
1483 |
+
"kind": 5,
|
1484 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1485 |
+
"description": ".venv.Scripts.sessionmirror",
|
1486 |
+
"peekOfCode": "PROJ_ATTRS = [\n 'xnat:projectData/name',\n 'xnat:projectData/description',\n 'xnat:projectData/keywords',\n]\nSUBJ_ATTRS = [\n 'xnat:subjectData/group',\n 'xnat:subjectData/src',\n 'xnat:subjectData/investigator/firstname',\n 'xnat:subjectData/investigator/lastname',",
|
1487 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1488 |
+
"documentation": {}
|
1489 |
+
},
|
1490 |
+
{
|
1491 |
+
"label": "SUBJ_ATTRS",
|
1492 |
+
"kind": 5,
|
1493 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1494 |
+
"description": ".venv.Scripts.sessionmirror",
|
1495 |
+
"peekOfCode": "SUBJ_ATTRS = [\n 'xnat:subjectData/group',\n 'xnat:subjectData/src',\n 'xnat:subjectData/investigator/firstname',\n 'xnat:subjectData/investigator/lastname',\n 'xnat:subjectData/demographics[@xsi:type=xnat:demographicData]/dob',\n 'xnat:subjectData/demographics[@xsi:type=xnat:demographicData]/yob',\n 'xnat:subjectData/demographics[@xsi:type=xnat:demographicData]/age',\n 'xnat:subjectData/demographics[@xsi:type=xnat:demographicData]/gender',\n 'xnat:subjectData/demographics[@xsi:type=xnat:demographicData]/handedness',",
|
1496 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1497 |
+
"documentation": {}
|
1498 |
+
},
|
1499 |
+
{
|
1500 |
+
"label": "MR_EXP_ATTRS",
|
1501 |
+
"kind": 5,
|
1502 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1503 |
+
"description": ".venv.Scripts.sessionmirror",
|
1504 |
+
"peekOfCode": "MR_EXP_ATTRS = [\n 'xnat:experimentData/date',\n 'xnat:experimentData/visit_id',\n 'xnat:experimentData/time',\n 'xnat:experimentData/note',\n 'xnat:experimentData/investigator/firstname',\n 'xnat:experimentData/investigator/lastname',\n 'xnat:imageSessionData/scanner/manufacturer',\n 'xnat:imageSessionData/scanner/model',\n 'xnat:imageSessionData/operator',",
|
1505 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1506 |
+
"documentation": {}
|
1507 |
+
},
|
1508 |
+
{
|
1509 |
+
"label": "OTHER_DICOM_SCAN_ATTRS",
|
1510 |
+
"kind": 5,
|
1511 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1512 |
+
"description": ".venv.Scripts.sessionmirror",
|
1513 |
+
"peekOfCode": "OTHER_DICOM_SCAN_ATTRS = [\n 'xnat:imageScanData/type',\n 'xnat:imageScanData/UID',\n 'xnat:imageScanData/note',\n 'xnat:imageScanData/quality',\n 'xnat:imageScanData/condition',\n 'xnat:imageScanData/series_description',\n 'xnat:imageScanData/documentation',\n 'xnat:imageScanData/frames',\n 'xnat:imageScanData/startTime',",
|
1514 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1515 |
+
"documentation": {}
|
1516 |
+
},
|
1517 |
+
{
|
1518 |
+
"label": "MR_SCAN_ATTRS",
|
1519 |
+
"kind": 5,
|
1520 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1521 |
+
"description": ".venv.Scripts.sessionmirror",
|
1522 |
+
"peekOfCode": "MR_SCAN_ATTRS = [\n 'xnat:imageScanData/type',\n 'xnat:imageScanData/UID',\n 'xnat:imageScanData/note',\n 'xnat:imageScanData/quality',\n 'xnat:imageScanData/condition',\n 'xnat:imageScanData/series_description',\n 'xnat:imageScanData/documentation',\n 'xnat:imageScanData/frames',\n 'xnat:imageScanData/startTime',",
|
1523 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1524 |
+
"documentation": {}
|
1525 |
+
},
|
1526 |
+
{
|
1527 |
+
"label": "SC_SCAN_ATTRS",
|
1528 |
+
"kind": 5,
|
1529 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1530 |
+
"description": ".venv.Scripts.sessionmirror",
|
1531 |
+
"peekOfCode": "SC_SCAN_ATTRS = [\n 'xnat:imageScanData/type',\n 'xnat:imageScanData/UID',\n 'xnat:imageScanData/note',\n 'xnat:imageScanData/quality',\n 'xnat:imageScanData/condition',\n 'xnat:imageScanData/series_description',\n 'xnat:imageScanData/documentation',\n 'xnat:imageScanData/frames',\n 'xnat:imageScanData/scanner/manufacturer',",
|
1532 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1533 |
+
"documentation": {}
|
1534 |
+
},
|
1535 |
+
{
|
1536 |
+
"label": "PET_EXP_ATTRS",
|
1537 |
+
"kind": 5,
|
1538 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1539 |
+
"description": ".venv.Scripts.sessionmirror",
|
1540 |
+
"peekOfCode": "PET_EXP_ATTRS = [\n 'xnat:experimentData/date',\n 'xnat:experimentData/visit_id',\n 'xnat:experimentData/time',\n 'xnat:experimentData/note',\n 'xnat:experimentData/investigator/firstname',\n 'xnat:experimentData/investigator/lastname',\n 'xnat:imageSessionData/scanner/manufacturer',\n 'xnat:imageSessionData/scanner/model',\n 'xnat:imageSessionData/operator',",
|
1541 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1542 |
+
"documentation": {}
|
1543 |
+
},
|
1544 |
+
{
|
1545 |
+
"label": "CT_EXP_ATTRS",
|
1546 |
+
"kind": 5,
|
1547 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1548 |
+
"description": ".venv.Scripts.sessionmirror",
|
1549 |
+
"peekOfCode": "CT_EXP_ATTRS = [\n 'xnat:experimentData/date',\n 'xnat:experimentData/visit_id',\n 'xnat:experimentData/time',\n 'xnat:experimentData/note',\n 'xnat:experimentData/investigator/firstname',\n 'xnat:experimentData/investigator/lastname',\n 'xnat:imageSessionData/scanner/manufacturer',\n 'xnat:imageSessionData/scanner/model',\n 'xnat:imageSessionData/operator',",
|
1550 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1551 |
+
"documentation": {}
|
1552 |
+
},
|
1553 |
+
{
|
1554 |
+
"label": "PET_SCAN_ATTRS",
|
1555 |
+
"kind": 5,
|
1556 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1557 |
+
"description": ".venv.Scripts.sessionmirror",
|
1558 |
+
"peekOfCode": "PET_SCAN_ATTRS = [\n 'xnat:imageScanData/type',\n 'xnat:imageScanData/UID',\n 'xnat:imageScanData/note',\n 'xnat:imageScanData/quality',\n 'xnat:imageScanData/condition',\n 'xnat:imageScanData/series_description',\n 'xnat:imageScanData/documentation',\n 'xnat:imageScanData/frames',\n 'xnat:imageScanData/scanner/manufacturer',",
|
1559 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1560 |
+
"documentation": {}
|
1561 |
+
},
|
1562 |
+
{
|
1563 |
+
"label": "CT_SCAN_ATTRS",
|
1564 |
+
"kind": 5,
|
1565 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1566 |
+
"description": ".venv.Scripts.sessionmirror",
|
1567 |
+
"peekOfCode": "CT_SCAN_ATTRS = [\n 'xnat:imageScanData/type',\n 'xnat:imageScanData/UID',\n 'xnat:imageScanData/note',\n 'xnat:imageScanData/quality',\n 'xnat:imageScanData/condition',\n 'xnat:imageScanData/series_description',\n 'xnat:imageScanData/documentation',\n 'xnat:imageScanData/frames',\n 'xnat:imageScanData/scanner/manufacturer',",
|
1568 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1569 |
+
"documentation": {}
|
1570 |
+
},
|
1571 |
+
{
|
1572 |
+
"label": "PROC_ATTRS",
|
1573 |
+
"kind": 5,
|
1574 |
+
"importPath": ".venv.Scripts.sessionmirror",
|
1575 |
+
"description": ".venv.Scripts.sessionmirror",
|
1576 |
+
"peekOfCode": "PROC_ATTRS = [\n 'proc:genProcData/validation/status',\n 'proc:genProcData/procstatus',\n 'proc:genProcData/proctype',\n 'proc:genProcData/procversion',\n 'proc:genProcData/walltimeused',\n 'proc:genProcData/memused'\n]\ndef copy_attrs(src_obj, dest_obj, attr_list):\n \"\"\" Copies list of attributes form source to destination\"\"\"",
|
1577 |
+
"detail": ".venv.Scripts.sessionmirror",
|
1578 |
+
"documentation": {}
|
1579 |
+
},
|
1580 |
+
{
|
1581 |
+
"label": "ModelError",
|
1582 |
+
"kind": 6,
|
1583 |
+
"importPath": "mcp_server.model.gemini_flash",
|
1584 |
+
"description": "mcp_server.model.gemini_flash",
|
1585 |
+
"peekOfCode": "class ModelError(Exception):\n \"\"\"Custom exception for model-related errors\"\"\"\n pass\ndef fallback_to_15_flash(method: Callable[..., T]) -> Callable[..., T]:\n \"\"\"\n Decorator to automatically fall back to 1.5 if 2.0 fails.\n Only applies when the instance's version is '2.0'.\n \"\"\"\n @wraps(method)\n async def wrapper(self: 'GeminiFlash', *args: Any, **kwargs: Any) -> T:",
|
1586 |
+
"detail": "mcp_server.model.gemini_flash",
|
1587 |
+
"documentation": {}
|
1588 |
+
},
|
1589 |
+
{
|
1590 |
+
"label": "GeminiFlash",
|
1591 |
+
"kind": 6,
|
1592 |
+
"importPath": "mcp_server.model.gemini_flash",
|
1593 |
+
"description": "mcp_server.model.gemini_flash",
|
1594 |
+
"peekOfCode": "class GeminiFlash:\n \"\"\"\n Google Gemini Flash model implementation with automatic fallback from 2.0 to 1.5.\n \"\"\"\n SUPPORTED_VERSIONS = ['2.0', '1.5']\n def __init__(self, version: str = '2.0', api_key: Optional[str] = None, _is_fallback: bool = False):\n \"\"\"\n Initialize the Gemini Flash model.\n Args:\n version: Model version ('2.0' or '1.5')",
|
1595 |
+
"detail": "mcp_server.model.gemini_flash",
|
1596 |
+
"documentation": {}
|
1597 |
+
},
|
1598 |
+
{
|
1599 |
+
"label": "fallback_to_15_flash",
|
1600 |
+
"kind": 2,
|
1601 |
+
"importPath": "mcp_server.model.gemini_flash",
|
1602 |
+
"description": "mcp_server.model.gemini_flash",
|
1603 |
+
"peekOfCode": "def fallback_to_15_flash(method: Callable[..., T]) -> Callable[..., T]:\n \"\"\"\n Decorator to automatically fall back to 1.5 if 2.0 fails.\n Only applies when the instance's version is '2.0'.\n \"\"\"\n @wraps(method)\n async def wrapper(self: 'GeminiFlash', *args: Any, **kwargs: Any) -> T:\n if self.version != '2.0' or not self._should_fallback:\n return await method(self, *args, **kwargs)\n try:",
|
1604 |
+
"detail": "mcp_server.model.gemini_flash",
|
1605 |
+
"documentation": {}
|
1606 |
+
},
|
1607 |
+
{
|
1608 |
+
"label": "logger",
|
1609 |
+
"kind": 5,
|
1610 |
+
"importPath": "mcp_server.model.gemini_flash",
|
1611 |
+
"description": "mcp_server.model.gemini_flash",
|
1612 |
+
"peekOfCode": "logger = logging.getLogger(__name__)\nT = TypeVar('T')\nclass ModelError(Exception):\n \"\"\"Custom exception for model-related errors\"\"\"\n pass\ndef fallback_to_15_flash(method: Callable[..., T]) -> Callable[..., T]:\n \"\"\"\n Decorator to automatically fall back to 1.5 if 2.0 fails.\n Only applies when the instance's version is '2.0'.\n \"\"\"",
|
1613 |
+
"detail": "mcp_server.model.gemini_flash",
|
1614 |
+
"documentation": {}
|
1615 |
+
},
|
1616 |
+
{
|
1617 |
+
"label": "T",
|
1618 |
+
"kind": 5,
|
1619 |
+
"importPath": "mcp_server.model.gemini_flash",
|
1620 |
+
"description": "mcp_server.model.gemini_flash",
|
1621 |
+
"peekOfCode": "T = TypeVar('T')\nclass ModelError(Exception):\n \"\"\"Custom exception for model-related errors\"\"\"\n pass\ndef fallback_to_15_flash(method: Callable[..., T]) -> Callable[..., T]:\n \"\"\"\n Decorator to automatically fall back to 1.5 if 2.0 fails.\n Only applies when the instance's version is '2.0'.\n \"\"\"\n @wraps(method)",
|
1622 |
+
"detail": "mcp_server.model.gemini_flash",
|
1623 |
+
"documentation": {}
|
1624 |
+
},
|
1625 |
+
{
|
1626 |
+
"label": "get_concept",
|
1627 |
+
"kind": 2,
|
1628 |
+
"importPath": "mcp_server.resources.concept_graph",
|
1629 |
+
"description": "mcp_server.resources.concept_graph",
|
1630 |
+
"peekOfCode": "def get_concept(concept_id: str) -> Dict[str, Any]:\n \"\"\"Get a specific concept by ID or return None if not found.\"\"\"\n return CONCEPT_GRAPH.get(concept_id)\ndef get_all_concepts() -> Dict[str, Any]:\n \"\"\"Get all concepts in the graph.\"\"\"\n return {\"concepts\": list(CONCEPT_GRAPH.values())}\ndef get_concept_graph() -> Dict[str, Any]:\n \"\"\"Get the complete concept graph.\"\"\"\n return CONCEPT_GRAPH",
|
1631 |
+
"detail": "mcp_server.resources.concept_graph",
|
1632 |
+
"documentation": {}
|
1633 |
+
},
|
1634 |
+
{
|
1635 |
+
"label": "get_all_concepts",
|
1636 |
+
"kind": 2,
|
1637 |
+
"importPath": "mcp_server.resources.concept_graph",
|
1638 |
+
"description": "mcp_server.resources.concept_graph",
|
1639 |
+
"peekOfCode": "def get_all_concepts() -> Dict[str, Any]:\n \"\"\"Get all concepts in the graph.\"\"\"\n return {\"concepts\": list(CONCEPT_GRAPH.values())}\ndef get_concept_graph() -> Dict[str, Any]:\n \"\"\"Get the complete concept graph.\"\"\"\n return CONCEPT_GRAPH",
|
1640 |
+
"detail": "mcp_server.resources.concept_graph",
|
1641 |
+
"documentation": {}
|
1642 |
+
},
|
1643 |
+
{
|
1644 |
+
"label": "get_concept_graph",
|
1645 |
+
"kind": 2,
|
1646 |
+
"importPath": "mcp_server.resources.concept_graph",
|
1647 |
+
"description": "mcp_server.resources.concept_graph",
|
1648 |
+
"peekOfCode": "def get_concept_graph() -> Dict[str, Any]:\n \"\"\"Get the complete concept graph.\"\"\"\n return CONCEPT_GRAPH",
|
1649 |
+
"detail": "mcp_server.resources.concept_graph",
|
1650 |
+
"documentation": {}
|
1651 |
+
},
|
1652 |
+
{
|
1653 |
+
"label": "CONCEPT_GRAPH",
|
1654 |
+
"kind": 5,
|
1655 |
+
"importPath": "mcp_server.resources.concept_graph",
|
1656 |
+
"description": "mcp_server.resources.concept_graph",
|
1657 |
+
"peekOfCode": "CONCEPT_GRAPH = {\n \"python\": {\n \"id\": \"python\",\n \"name\": \"Python Programming\",\n \"description\": \"Fundamentals of Python programming language\",\n \"prerequisites\": [],\n \"related\": [\"functions\", \"oop\", \"data_structures\"]\n },\n \"functions\": {\n \"id\": \"functions\",",
|
1658 |
+
"detail": "mcp_server.resources.concept_graph",
|
1659 |
+
"documentation": {}
|
1660 |
+
},
|
1661 |
+
{
|
1662 |
+
"label": "get_curriculum_standards",
|
1663 |
+
"kind": 2,
|
1664 |
+
"importPath": "mcp_server.resources.curriculum_standards",
|
1665 |
+
"description": "mcp_server.resources.curriculum_standards",
|
1666 |
+
"peekOfCode": "def get_curriculum_standards(country_code: str = \"us\") -> Dict[str, Any]:\n \"\"\"\n Get curriculum standards for a specific country.\n Args:\n country_code: ISO country code (e.g., 'us', 'uk', 'in', 'sg', 'ca')\n Returns:\n Dictionary containing curriculum standards for the specified country\n \"\"\"\n country_code = country_code.lower()\n if country_code not in CURRICULUM_STANDARDS:",
|
1667 |
+
"detail": "mcp_server.resources.curriculum_standards",
|
1668 |
+
"documentation": {}
|
1669 |
+
},
|
1670 |
+
{
|
1671 |
+
"label": "CURRICULUM_STANDARDS",
|
1672 |
+
"kind": 5,
|
1673 |
+
"importPath": "mcp_server.resources.curriculum_standards",
|
1674 |
+
"description": "mcp_server.resources.curriculum_standards",
|
1675 |
+
"peekOfCode": "CURRICULUM_STANDARDS = {\n \"us\": {\n \"name\": \"Common Core State Standards (US)\",\n \"subjects\": {\n \"math\": {\n \"k-5\": [\"Counting & Cardinality\", \"Operations & Algebraic Thinking\", \"Number & Operations\"],\n \"6-8\": [\"Ratios & Proportional Relationships\", \"The Number System\", \"Expressions & Equations\"],\n \"9-12\": [\"Number & Quantity\", \"Algebra\", \"Functions\", \"Modeling\", \"Geometry\", \"Statistics & Probability\"]\n },\n \"ela\": {",
|
1676 |
+
"detail": "mcp_server.resources.curriculum_standards",
|
1677 |
+
"documentation": {}
|
1678 |
+
},
|
1679 |
+
{
|
1680 |
+
"label": "current_dir",
|
1681 |
+
"kind": 5,
|
1682 |
+
"importPath": "mcp_server.tools.concept_graph_tools",
|
1683 |
+
"description": "mcp_server.tools.concept_graph_tools",
|
1684 |
+
"peekOfCode": "current_dir = Path(__file__).parent\nparent_dir = current_dir.parent.parent\nsys.path.insert(0, str(parent_dir))\nimport sys\nimport os\nfrom pathlib import Path\n# Add the parent directory to the Python path\ncurrent_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))",
|
1685 |
+
"detail": "mcp_server.tools.concept_graph_tools",
|
1686 |
+
"documentation": {}
|
1687 |
+
},
|
1688 |
+
{
|
1689 |
+
"label": "parent_dir",
|
1690 |
+
"kind": 5,
|
1691 |
+
"importPath": "mcp_server.tools.concept_graph_tools",
|
1692 |
+
"description": "mcp_server.tools.concept_graph_tools",
|
1693 |
+
"peekOfCode": "parent_dir = current_dir.parent.parent\nsys.path.insert(0, str(parent_dir))\nimport sys\nimport os\nfrom pathlib import Path\n# Add the parent directory to the Python path\ncurrent_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources",
|
1694 |
+
"detail": "mcp_server.tools.concept_graph_tools",
|
1695 |
+
"documentation": {}
|
1696 |
+
},
|
1697 |
+
{
|
1698 |
+
"label": "current_dir",
|
1699 |
+
"kind": 5,
|
1700 |
+
"importPath": "mcp_server.tools.concept_graph_tools",
|
1701 |
+
"description": "mcp_server.tools.concept_graph_tools",
|
1702 |
+
"peekOfCode": "current_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources\nfrom resources import concept_graph\n# Import MCP\nfrom mcp_server.mcp_instance import mcp\nfrom mcp_server.model.gemini_flash import GeminiFlash\nMODEL = GeminiFlash()\[email protected]()",
|
1703 |
+
"detail": "mcp_server.tools.concept_graph_tools",
|
1704 |
+
"documentation": {}
|
1705 |
+
},
|
1706 |
+
{
|
1707 |
+
"label": "parent_dir",
|
1708 |
+
"kind": 5,
|
1709 |
+
"importPath": "mcp_server.tools.concept_graph_tools",
|
1710 |
+
"description": "mcp_server.tools.concept_graph_tools",
|
1711 |
+
"peekOfCode": "parent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources\nfrom resources import concept_graph\n# Import MCP\nfrom mcp_server.mcp_instance import mcp\nfrom mcp_server.model.gemini_flash import GeminiFlash\nMODEL = GeminiFlash()\[email protected]()\nasync def get_concept_graph_tool(concept_id: Optional[str] = None) -> dict:",
|
1712 |
+
"detail": "mcp_server.tools.concept_graph_tools",
|
1713 |
+
"documentation": {}
|
1714 |
+
},
|
1715 |
+
{
|
1716 |
+
"label": "MODEL",
|
1717 |
+
"kind": 5,
|
1718 |
+
"importPath": "mcp_server.tools.concept_graph_tools",
|
1719 |
+
"description": "mcp_server.tools.concept_graph_tools",
|
1720 |
+
"peekOfCode": "MODEL = GeminiFlash()\[email protected]()\nasync def get_concept_graph_tool(concept_id: Optional[str] = None) -> dict:\n \"\"\"\n Get the complete concept graph or a specific concept, fully LLM-driven.\n For a specific concept, use Gemini to generate a JSON object with explanation, related concepts, prerequisites, and summary.\n For the full graph, use Gemini to generate a JSON object with a list of all concepts and their relationships.\n \"\"\"\n if concept_id:\n prompt = (",
|
1721 |
+
"detail": "mcp_server.tools.concept_graph_tools",
|
1722 |
+
"documentation": {}
|
1723 |
+
},
|
1724 |
+
{
|
1725 |
+
"label": "current_dir",
|
1726 |
+
"kind": 5,
|
1727 |
+
"importPath": "mcp_server.tools.concept_tools",
|
1728 |
+
"description": "mcp_server.tools.concept_tools",
|
1729 |
+
"peekOfCode": "current_dir = Path(__file__).parent\nparent_dir = current_dir.parent.parent\nsys.path.insert(0, str(parent_dir))\nimport sys\nimport os\nfrom pathlib import Path\n# Add the parent directory to the Python path\ncurrent_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))",
|
1730 |
+
"detail": "mcp_server.tools.concept_tools",
|
1731 |
+
"documentation": {}
|
1732 |
+
},
|
1733 |
+
{
|
1734 |
+
"label": "parent_dir",
|
1735 |
+
"kind": 5,
|
1736 |
+
"importPath": "mcp_server.tools.concept_tools",
|
1737 |
+
"description": "mcp_server.tools.concept_tools",
|
1738 |
+
"peekOfCode": "parent_dir = current_dir.parent.parent\nsys.path.insert(0, str(parent_dir))\nimport sys\nimport os\nfrom pathlib import Path\n# Add the parent directory to the Python path\ncurrent_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources",
|
1739 |
+
"detail": "mcp_server.tools.concept_tools",
|
1740 |
+
"documentation": {}
|
1741 |
+
},
|
1742 |
+
{
|
1743 |
+
"label": "current_dir",
|
1744 |
+
"kind": 5,
|
1745 |
+
"importPath": "mcp_server.tools.concept_tools",
|
1746 |
+
"description": "mcp_server.tools.concept_tools",
|
1747 |
+
"peekOfCode": "current_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources\nfrom resources.concept_graph import get_concept, get_all_concepts\n# Import MCP\nfrom mcp_server.mcp_instance import mcp\nfrom mcp_server.model.gemini_flash import GeminiFlash\nMODEL = GeminiFlash()\[email protected]()",
|
1748 |
+
"detail": "mcp_server.tools.concept_tools",
|
1749 |
+
"documentation": {}
|
1750 |
+
},
|
1751 |
+
{
|
1752 |
+
"label": "parent_dir",
|
1753 |
+
"kind": 5,
|
1754 |
+
"importPath": "mcp_server.tools.concept_tools",
|
1755 |
+
"description": "mcp_server.tools.concept_tools",
|
1756 |
+
"peekOfCode": "parent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources\nfrom resources.concept_graph import get_concept, get_all_concepts\n# Import MCP\nfrom mcp_server.mcp_instance import mcp\nfrom mcp_server.model.gemini_flash import GeminiFlash\nMODEL = GeminiFlash()\[email protected]()\nasync def get_concept_tool(concept_id: str = None) -> dict:",
|
1757 |
+
"detail": "mcp_server.tools.concept_tools",
|
1758 |
+
"documentation": {}
|
1759 |
+
},
|
1760 |
+
{
|
1761 |
+
"label": "MODEL",
|
1762 |
+
"kind": 5,
|
1763 |
+
"importPath": "mcp_server.tools.concept_tools",
|
1764 |
+
"description": "mcp_server.tools.concept_tools",
|
1765 |
+
"peekOfCode": "MODEL = GeminiFlash()\[email protected]()\nasync def get_concept_tool(concept_id: str = None) -> dict:\n \"\"\"\n Get a specific concept or all concepts from the knowledge graph, fully LLM-driven.\n If a concept_id is provided, use Gemini to generate a JSON object with explanation, key points, and example.\n \"\"\"\n if not concept_id:\n return {\"error\": \"concept_id is required for LLM-driven mode\"}\n prompt = (",
|
1766 |
+
"detail": "mcp_server.tools.concept_tools",
|
1767 |
+
"documentation": {}
|
1768 |
+
},
|
1769 |
+
{
|
1770 |
+
"label": "calculate_similarity",
|
1771 |
+
"kind": 2,
|
1772 |
+
"importPath": "mcp_server.tools.interaction_tools",
|
1773 |
+
"description": "mcp_server.tools.interaction_tools",
|
1774 |
+
"peekOfCode": "def calculate_similarity(text1: str, text2: str) -> float:\n \"\"\"Calculate the similarity ratio between two texts.\"\"\"\n return 0.0 # No longer used, LLM-driven\[email protected]()\nasync def text_interaction(query: str, student_id: str) -> dict:\n \"\"\"\n Process a text query from a student and provide an educational response, fully LLM-driven.\n Use Gemini to generate a JSON object with a response and suggested actions/resources.\n \"\"\"\n prompt = (",
|
1775 |
+
"detail": "mcp_server.tools.interaction_tools",
|
1776 |
+
"documentation": {}
|
1777 |
+
},
|
1778 |
+
{
|
1779 |
+
"label": "MODEL",
|
1780 |
+
"kind": 5,
|
1781 |
+
"importPath": "mcp_server.tools.interaction_tools",
|
1782 |
+
"description": "mcp_server.tools.interaction_tools",
|
1783 |
+
"peekOfCode": "MODEL = GeminiFlash()\ndef calculate_similarity(text1: str, text2: str) -> float:\n \"\"\"Calculate the similarity ratio between two texts.\"\"\"\n return 0.0 # No longer used, LLM-driven\[email protected]()\nasync def text_interaction(query: str, student_id: str) -> dict:\n \"\"\"\n Process a text query from a student and provide an educational response, fully LLM-driven.\n Use Gemini to generate a JSON object with a response and suggested actions/resources.\n \"\"\"",
|
1784 |
+
"detail": "mcp_server.tools.interaction_tools",
|
1785 |
+
"documentation": {}
|
1786 |
+
},
|
1787 |
+
{
|
1788 |
+
"label": "get_prerequisites",
|
1789 |
+
"kind": 2,
|
1790 |
+
"importPath": "mcp_server.tools.learning_path_tools",
|
1791 |
+
"description": "mcp_server.tools.learning_path_tools",
|
1792 |
+
"peekOfCode": "def get_prerequisites(concept_id: str, visited: Optional[set] = None) -> List[Dict[str, Any]]:\n \"\"\"\n Get all prerequisites for a concept recursively.\n Args:\n concept_id: ID of the concept to get prerequisites for\n visited: Set of already visited concepts to avoid cycles\n Returns:\n List of prerequisite concepts in order\n \"\"\"\n if visited is None:",
|
1793 |
+
"detail": "mcp_server.tools.learning_path_tools",
|
1794 |
+
"documentation": {}
|
1795 |
+
},
|
1796 |
+
{
|
1797 |
+
"label": "generate_learning_path",
|
1798 |
+
"kind": 2,
|
1799 |
+
"importPath": "mcp_server.tools.learning_path_tools",
|
1800 |
+
"description": "mcp_server.tools.learning_path_tools",
|
1801 |
+
"peekOfCode": "def generate_learning_path(concept_ids: List[str], student_level: str = \"beginner\") -> Dict[str, Any]:\n \"\"\"\n Generate a personalized learning path for a student.\n Args:\n concept_ids: List of concept IDs to include in the learning path\n student_level: Student's current level (beginner, intermediate, advanced)\n Returns:\n Dictionary containing the learning path\n \"\"\"\n if not concept_ids:",
|
1802 |
+
"detail": "mcp_server.tools.learning_path_tools",
|
1803 |
+
"documentation": {}
|
1804 |
+
},
|
1805 |
+
{
|
1806 |
+
"label": "current_dir",
|
1807 |
+
"kind": 5,
|
1808 |
+
"importPath": "mcp_server.tools.learning_path_tools",
|
1809 |
+
"description": "mcp_server.tools.learning_path_tools",
|
1810 |
+
"peekOfCode": "current_dir = Path(__file__).parent\nparent_dir = current_dir.parent.parent\nsys.path.insert(0, str(parent_dir))\nimport sys\nimport os\nfrom pathlib import Path\n# Add the parent directory to the Python path\ncurrent_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))",
|
1811 |
+
"detail": "mcp_server.tools.learning_path_tools",
|
1812 |
+
"documentation": {}
|
1813 |
+
},
|
1814 |
+
{
|
1815 |
+
"label": "parent_dir",
|
1816 |
+
"kind": 5,
|
1817 |
+
"importPath": "mcp_server.tools.learning_path_tools",
|
1818 |
+
"description": "mcp_server.tools.learning_path_tools",
|
1819 |
+
"peekOfCode": "parent_dir = current_dir.parent.parent\nsys.path.insert(0, str(parent_dir))\nimport sys\nimport os\nfrom pathlib import Path\n# Add the parent directory to the Python path\ncurrent_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources",
|
1820 |
+
"detail": "mcp_server.tools.learning_path_tools",
|
1821 |
+
"documentation": {}
|
1822 |
+
},
|
1823 |
+
{
|
1824 |
+
"label": "current_dir",
|
1825 |
+
"kind": 5,
|
1826 |
+
"importPath": "mcp_server.tools.learning_path_tools",
|
1827 |
+
"description": "mcp_server.tools.learning_path_tools",
|
1828 |
+
"peekOfCode": "current_dir = Path(__file__).parent\nparent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources\nfrom resources.concept_graph import CONCEPT_GRAPH\n# Import MCP\nfrom mcp_server.mcp_instance import mcp\nfrom mcp_server.model.gemini_flash import GeminiFlash\nMODEL = GeminiFlash()\ndef get_prerequisites(concept_id: str, visited: Optional[set] = None) -> List[Dict[str, Any]]:",
|
1829 |
+
"detail": "mcp_server.tools.learning_path_tools",
|
1830 |
+
"documentation": {}
|
1831 |
+
},
|
1832 |
+
{
|
1833 |
+
"label": "parent_dir",
|
1834 |
+
"kind": 5,
|
1835 |
+
"importPath": "mcp_server.tools.learning_path_tools",
|
1836 |
+
"description": "mcp_server.tools.learning_path_tools",
|
1837 |
+
"peekOfCode": "parent_dir = current_dir.parent\nsys.path.insert(0, str(parent_dir))\n# Import from local resources\nfrom resources.concept_graph import CONCEPT_GRAPH\n# Import MCP\nfrom mcp_server.mcp_instance import mcp\nfrom mcp_server.model.gemini_flash import GeminiFlash\nMODEL = GeminiFlash()\ndef get_prerequisites(concept_id: str, visited: Optional[set] = None) -> List[Dict[str, Any]]:\n \"\"\"",
|
1838 |
+
"detail": "mcp_server.tools.learning_path_tools",
|
1839 |
+
"documentation": {}
|
1840 |
+
},
|
1841 |
+
{
|
1842 |
+
"label": "MODEL",
|
1843 |
+
"kind": 5,
|
1844 |
+
"importPath": "mcp_server.tools.learning_path_tools",
|
1845 |
+
"description": "mcp_server.tools.learning_path_tools",
|
1846 |
+
"peekOfCode": "MODEL = GeminiFlash()\ndef get_prerequisites(concept_id: str, visited: Optional[set] = None) -> List[Dict[str, Any]]:\n \"\"\"\n Get all prerequisites for a concept recursively.\n Args:\n concept_id: ID of the concept to get prerequisites for\n visited: Set of already visited concepts to avoid cycles\n Returns:\n List of prerequisite concepts in order\n \"\"\"",
|
1847 |
+
"detail": "mcp_server.tools.learning_path_tools",
|
1848 |
+
"documentation": {}
|
1849 |
+
},
|
1850 |
+
{
|
1851 |
+
"label": "MODEL",
|
1852 |
+
"kind": 5,
|
1853 |
+
"importPath": "mcp_server.tools.lesson_tools",
|
1854 |
+
"description": "mcp_server.tools.lesson_tools",
|
1855 |
+
"peekOfCode": "MODEL = GeminiFlash()\[email protected]()\nasync def generate_lesson_tool(topic: str, grade_level: int, duration_minutes: int) -> dict:\n \"\"\"\n Generate a lesson plan for the given topic, grade level, and duration, fully LLM-driven.\n Use Gemini to generate a JSON object with objectives, activities, materials, assessment, differentiation, and homework.\n \"\"\"\n prompt = (\n f\"Generate a detailed lesson plan as a JSON object for the topic '{topic}', grade {grade_level}, duration {duration_minutes} minutes. \"\n f\"Include fields: objectives (list), activities (list), materials (list), assessment (dict), differentiation (dict), and homework (dict).\"",
|
1856 |
+
"detail": "mcp_server.tools.lesson_tools",
|
1857 |
+
"documentation": {}
|
1858 |
+
},
|
1859 |
+
{
|
1860 |
+
"label": "MODEL",
|
1861 |
+
"kind": 5,
|
1862 |
+
"importPath": "mcp_server.tools.ocr_tools",
|
1863 |
+
"description": "mcp_server.tools.ocr_tools",
|
1864 |
+
"peekOfCode": "MODEL = GeminiFlash()\nasync def mistral_ocr_request(document_url: str) -> dict:\n \"\"\"\n Send OCR request to Mistral OCR service using document URL.\n Args:\n document_url: URL of the document to process\n Returns:\n OCR response from Mistral\n \"\"\"\n try:",
|
1865 |
+
"detail": "mcp_server.tools.ocr_tools",
|
1866 |
+
"documentation": {}
|
1867 |
+
},
|
1868 |
+
{
|
1869 |
+
"label": "result",
|
1870 |
+
"kind": 5,
|
1871 |
+
"importPath": "mcp_server.tools.ocr_tools",
|
1872 |
+
"description": "mcp_server.tools.ocr_tools",
|
1873 |
+
"peekOfCode": "result = await mistral_document_ocr(\"https://example.com/document.pdf\")\n# For image document \nresult = await mistral_document_ocr(\"https://example.com/image.jpg\")\n\"\"\"",
|
1874 |
+
"detail": "mcp_server.tools.ocr_tools",
|
1875 |
+
"documentation": {}
|
1876 |
+
},
|
1877 |
+
{
|
1878 |
+
"label": "result",
|
1879 |
+
"kind": 5,
|
1880 |
+
"importPath": "mcp_server.tools.ocr_tools",
|
1881 |
+
"description": "mcp_server.tools.ocr_tools",
|
1882 |
+
"peekOfCode": "result = await mistral_document_ocr(\"https://example.com/image.jpg\")\n\"\"\"",
|
1883 |
+
"detail": "mcp_server.tools.ocr_tools",
|
1884 |
+
"documentation": {}
|
1885 |
+
},
|
1886 |
+
{
|
1887 |
+
"label": "PROMPT_TEMPLATE",
|
1888 |
+
"kind": 5,
|
1889 |
+
"importPath": "mcp_server.tools.quiz_tools",
|
1890 |
+
"description": "mcp_server.tools.quiz_tools",
|
1891 |
+
"peekOfCode": "PROMPT_TEMPLATE = (Path(__file__).parent.parent / \"prompts\" / \"quiz_generation.txt\").read_text(encoding=\"utf-8\")\n# Initialize Gemini model\nMODEL = GeminiFlash()\[email protected]()\nasync def generate_quiz_tool(concept: str, difficulty: str = \"medium\") -> dict:\n \"\"\"\n Generate a quiz based on a concept and difficulty using Gemini, fully LLM-driven.\n The JSON should include a list of questions, each with options and the correct answer.\n \"\"\"\n try:",
|
1892 |
+
"detail": "mcp_server.tools.quiz_tools",
|
1893 |
+
"documentation": {}
|
1894 |
+
},
|
1895 |
+
{
|
1896 |
+
"label": "MODEL",
|
1897 |
+
"kind": 5,
|
1898 |
+
"importPath": "mcp_server.tools.quiz_tools",
|
1899 |
+
"description": "mcp_server.tools.quiz_tools",
|
1900 |
+
"peekOfCode": "MODEL = GeminiFlash()\[email protected]()\nasync def generate_quiz_tool(concept: str, difficulty: str = \"medium\") -> dict:\n \"\"\"\n Generate a quiz based on a concept and difficulty using Gemini, fully LLM-driven.\n The JSON should include a list of questions, each with options and the correct answer.\n \"\"\"\n try:\n if not concept or not isinstance(concept, str):\n return {\"error\": \"concept must be a non-empty string\"}",
|
1901 |
+
"detail": "mcp_server.tools.quiz_tools",
|
1902 |
+
"documentation": {}
|
1903 |
+
},
|
1904 |
+
{
|
1905 |
+
"label": "upload_to_azure",
|
1906 |
+
"kind": 2,
|
1907 |
+
"importPath": "mcp_server.utils.azure_upload",
|
1908 |
+
"description": "mcp_server.utils.azure_upload",
|
1909 |
+
"peekOfCode": "def upload_to_azure(file_path: str, content_type: str = None) -> str:\n \"\"\"\n Upload a file to Azure Blob Storage and return the public URL.\n Args:\n file_path: Path to the file to upload.\n content_type: Optional MIME type (e.g., 'application/pdf'). If not provided, guessed from extension.\n Returns:\n The public URL of the uploaded blob.\n \"\"\"\n if not AZURE_CONNECTION_STRING or not AZURE_CONTAINER_NAME:",
|
1910 |
+
"detail": "mcp_server.utils.azure_upload",
|
1911 |
+
"documentation": {}
|
1912 |
+
},
|
1913 |
+
{
|
1914 |
+
"label": "AZURE_CONNECTION_STRING",
|
1915 |
+
"kind": 5,
|
1916 |
+
"importPath": "mcp_server.utils.azure_upload",
|
1917 |
+
"description": "mcp_server.utils.azure_upload",
|
1918 |
+
"peekOfCode": "AZURE_CONNECTION_STRING = os.getenv(\"AZURE_CONNECTION_STRING\")\nAZURE_CONTAINER_NAME = os.getenv(\"AZURE_CONTAINER_NAME\")\ndef upload_to_azure(file_path: str, content_type: str = None) -> str:\n \"\"\"\n Upload a file to Azure Blob Storage and return the public URL.\n Args:\n file_path: Path to the file to upload.\n content_type: Optional MIME type (e.g., 'application/pdf'). If not provided, guessed from extension.\n Returns:\n The public URL of the uploaded blob.",
|
1919 |
+
"detail": "mcp_server.utils.azure_upload",
|
1920 |
+
"documentation": {}
|
1921 |
+
},
|
1922 |
+
{
|
1923 |
+
"label": "AZURE_CONTAINER_NAME",
|
1924 |
+
"kind": 5,
|
1925 |
+
"importPath": "mcp_server.utils.azure_upload",
|
1926 |
+
"description": "mcp_server.utils.azure_upload",
|
1927 |
+
"peekOfCode": "AZURE_CONTAINER_NAME = os.getenv(\"AZURE_CONTAINER_NAME\")\ndef upload_to_azure(file_path: str, content_type: str = None) -> str:\n \"\"\"\n Upload a file to Azure Blob Storage and return the public URL.\n Args:\n file_path: Path to the file to upload.\n content_type: Optional MIME type (e.g., 'application/pdf'). If not provided, guessed from extension.\n Returns:\n The public URL of the uploaded blob.\n \"\"\"",
|
1928 |
+
"detail": "mcp_server.utils.azure_upload",
|
1929 |
+
"documentation": {}
|
1930 |
+
},
|
1931 |
+
{
|
1932 |
+
"label": "mcp",
|
1933 |
+
"kind": 5,
|
1934 |
+
"importPath": "mcp_server.mcp_instance",
|
1935 |
+
"description": "mcp_server.mcp_instance",
|
1936 |
+
"peekOfCode": "mcp = FastMCP(\n \"TutorX\",\n dependencies=[\"mcp[cli]>=1.9.3\"],\n cors_origins=[\"*\"]\n)",
|
1937 |
+
"detail": "mcp_server.mcp_instance",
|
1938 |
+
"documentation": {}
|
1939 |
+
},
|
1940 |
+
{
|
1941 |
+
"label": "current_dir",
|
1942 |
+
"kind": 5,
|
1943 |
+
"importPath": "mcp_server.server",
|
1944 |
+
"description": "mcp_server.server",
|
1945 |
+
"peekOfCode": "current_dir = Path(__file__).parent\nsys.path.insert(0, str(current_dir))\nimport uvicorn\nfrom fastapi import FastAPI, HTTPException, UploadFile, File, Form\nfrom fastapi.middleware.cors import CORSMiddleware\nfrom mcp.server.fastmcp import FastMCP\n# Import all tools to register them with MCP\nfrom tools import (\n concept_tools,\n lesson_tools,",
|
1946 |
+
"detail": "mcp_server.server",
|
1947 |
+
"documentation": {}
|
1948 |
+
},
|
1949 |
+
{
|
1950 |
+
"label": "api_app",
|
1951 |
+
"kind": 5,
|
1952 |
+
"importPath": "mcp_server.server",
|
1953 |
+
"description": "mcp_server.server",
|
1954 |
+
"peekOfCode": "api_app = FastAPI(\n title=\"TutorX MCP Server\",\n description=\"Model Context Protocol server for TutorX educational platform\",\n version=\"1.0.0\"\n)\n# Add CORS middleware\napi_app.add_middleware(\n CORSMiddleware,\n allow_origins=[\"*\"],\n allow_credentials=True,",
|
1955 |
+
"detail": "mcp_server.server",
|
1956 |
+
"documentation": {}
|
1957 |
+
},
|
1958 |
+
{
|
1959 |
+
"label": "TestTutorXClient",
|
1960 |
+
"kind": 6,
|
1961 |
+
"importPath": "tests.test_client",
|
1962 |
+
"description": "tests.test_client",
|
1963 |
+
"peekOfCode": "class TestTutorXClient(unittest.TestCase):\n \"\"\"Test cases for the TutorX MCP client\"\"\"\n def setUp(self):\n \"\"\"Set up test fixtures\"\"\"\n self.client = TutorXClient(\"http://localhost:8000\")\n self.student_id = \"test_student_123\"\n self.concept_id = \"math_algebra_basics\"\n @patch('client.requests.post')\n def test_call_tool(self, mock_post):\n \"\"\"Test _call_tool method\"\"\"",
|
1964 |
+
"detail": "tests.test_client",
|
1965 |
+
"documentation": {}
|
1966 |
+
},
|
1967 |
+
{
|
1968 |
+
"label": "TestMCPServer",
|
1969 |
+
"kind": 6,
|
1970 |
+
"importPath": "tests.test_mcp_server",
|
1971 |
+
"description": "tests.test_mcp_server",
|
1972 |
+
"peekOfCode": "class TestMCPServer(unittest.TestCase):\n \"\"\"Test cases for the TutorX MCP server\"\"\"\n def setUp(self):\n \"\"\"Set up test fixtures\"\"\"\n self.student_id = \"test_student_123\"\n self.concept_id = \"math_algebra_basics\"\n def test_assess_skill(self):\n \"\"\"Test assess_skill tool\"\"\"\n result = assess_skill(self.student_id, self.concept_id)\n # Verify the structure of the result",
|
1973 |
+
"detail": "tests.test_mcp_server",
|
1974 |
+
"documentation": {}
|
1975 |
+
},
|
1976 |
+
{
|
1977 |
+
"label": "SERVER_URL",
|
1978 |
+
"kind": 5,
|
1979 |
+
"importPath": "tests.test_tools_integration",
|
1980 |
+
"description": "tests.test_tools_integration",
|
1981 |
+
"peekOfCode": "SERVER_URL = \"http://localhost:8000/sse\" # Adjust if needed\[email protected]\nasync def test_get_concept_graph_tool():\n async with sse_client(SERVER_URL) as (sse, write):\n async with ClientSession(sse, write) as session:\n await session.initialize()\n result = await session.call_tool(\"get_concept_graph_tool\", {\"concept_id\": \"python\"})\n assert result and \"error\" not in result\[email protected]\nasync def test_generate_quiz_tool():",
|
1982 |
+
"detail": "tests.test_tools_integration",
|
1983 |
+
"documentation": {}
|
1984 |
+
},
|
1985 |
+
{
|
1986 |
+
"label": "TestMultimodalUtils",
|
1987 |
+
"kind": 6,
|
1988 |
+
"importPath": "tests.test_utils",
|
1989 |
+
"description": "tests.test_utils",
|
1990 |
+
"peekOfCode": "class TestMultimodalUtils(unittest.TestCase):\n \"\"\"Test cases for multimodal utility functions\"\"\"\n def test_process_text_query(self):\n \"\"\"Test text query processing\"\"\"\n # Test with a \"solve\" query\n solve_query = \"Please solve this equation: 2x + 3 = 7\"\n result = process_text_query(solve_query)\n self.assertIsInstance(result, dict)\n self.assertEqual(result[\"query\"], solve_query)\n self.assertEqual(result[\"response_type\"], \"math_solution\")",
|
1991 |
+
"detail": "tests.test_utils",
|
1992 |
+
"documentation": {}
|
1993 |
+
},
|
1994 |
+
{
|
1995 |
+
"label": "TestAssessmentUtils",
|
1996 |
+
"kind": 6,
|
1997 |
+
"importPath": "tests.test_utils",
|
1998 |
+
"description": "tests.test_utils",
|
1999 |
+
"peekOfCode": "class TestAssessmentUtils(unittest.TestCase):\n \"\"\"Test cases for assessment utility functions\"\"\"\n def test_generate_question_algebra_basics(self):\n \"\"\"Test question generation for algebra basics\"\"\"\n concept_id = \"math_algebra_basics\"\n difficulty = 2\n question = generate_question(concept_id, difficulty)\n self.assertIsInstance(question, dict)\n self.assertIn(\"id\", question)\n self.assertEqual(question[\"concept_id\"], concept_id)",
|
2000 |
+
"detail": "tests.test_utils",
|
2001 |
+
"documentation": {}
|
2002 |
+
},
|
2003 |
+
{
|
2004 |
+
"label": "upload_to_azure",
|
2005 |
+
"kind": 2,
|
2006 |
+
"importPath": "utils.azure_upload",
|
2007 |
+
"description": "utils.azure_upload",
|
2008 |
+
"peekOfCode": "def upload_to_azure(file_path: str, content_type: str = None) -> str:\n \"\"\"\n Upload a file to Azure Blob Storage and return the public URL.\n Args:\n file_path: Path to the file to upload.\n content_type: Optional MIME type (e.g., 'application/pdf'). If not provided, guessed from extension.\n Returns:\n The public URL of the uploaded blob.\n \"\"\"\n if not AZURE_CONNECTION_STRING or not AZURE_CONTAINER_NAME:",
|
2009 |
+
"detail": "utils.azure_upload",
|
2010 |
+
"documentation": {}
|
2011 |
+
},
|
2012 |
+
{
|
2013 |
+
"label": "AZURE_CONNECTION_STRING",
|
2014 |
+
"kind": 5,
|
2015 |
+
"importPath": "utils.azure_upload",
|
2016 |
+
"description": "utils.azure_upload",
|
2017 |
+
"peekOfCode": "AZURE_CONNECTION_STRING = os.getenv(\"AZURE_CONNECTION_STRING\")\nAZURE_CONTAINER_NAME = os.getenv(\"AZURE_CONTAINER_NAME\")\ndef upload_to_azure(file_path: str, content_type: str = None) -> str:\n \"\"\"\n Upload a file to Azure Blob Storage and return the public URL.\n Args:\n file_path: Path to the file to upload.\n content_type: Optional MIME type (e.g., 'application/pdf'). If not provided, guessed from extension.\n Returns:\n The public URL of the uploaded blob.",
|
2018 |
+
"detail": "utils.azure_upload",
|
2019 |
+
"documentation": {}
|
2020 |
+
},
|
2021 |
+
{
|
2022 |
+
"label": "AZURE_CONTAINER_NAME",
|
2023 |
+
"kind": 5,
|
2024 |
+
"importPath": "utils.azure_upload",
|
2025 |
+
"description": "utils.azure_upload",
|
2026 |
+
"peekOfCode": "AZURE_CONTAINER_NAME = os.getenv(\"AZURE_CONTAINER_NAME\")\ndef upload_to_azure(file_path: str, content_type: str = None) -> str:\n \"\"\"\n Upload a file to Azure Blob Storage and return the public URL.\n Args:\n file_path: Path to the file to upload.\n content_type: Optional MIME type (e.g., 'application/pdf'). If not provided, guessed from extension.\n Returns:\n The public URL of the uploaded blob.\n \"\"\"",
|
2027 |
+
"detail": "utils.azure_upload",
|
2028 |
+
"documentation": {}
|
2029 |
+
},
|
2030 |
+
{
|
2031 |
+
"label": "SERVER_URL",
|
2032 |
+
"kind": 5,
|
2033 |
+
"importPath": "app",
|
2034 |
+
"description": "app",
|
2035 |
+
"peekOfCode": "SERVER_URL = \"http://localhost:8000/sse\" # Ensure this is the SSE endpoint\n# Utility functions\nasync def load_concept_graph(concept_id: str = None):\n \"\"\"\n Load and visualize the concept graph for a given concept ID.\n If no concept_id is provided, returns the first available concept.\n Uses call_resource for concept graph retrieval (not a tool).\n Returns:\n tuple: (figure, concept_details, related_concepts) or (None, error_dict, [])\n \"\"\"",
|
2036 |
+
"detail": "app",
|
2037 |
+
"documentation": {}
|
2038 |
+
},
|
2039 |
+
{
|
2040 |
+
"label": "run_server",
|
2041 |
+
"kind": 2,
|
2042 |
+
"importPath": "main",
|
2043 |
+
"description": "main",
|
2044 |
+
"peekOfCode": "def run_server():\n \"\"\"Run the MCP server with the configured settings.\"\"\"\n print(f\"Starting TutorX MCP server on {SERVER_HOST}:{SERVER_PORT}...\")\n print(f\"MCP transport: {SERVER_TRANSPORT}\")\n print(f\"API docs: http://{SERVER_HOST}:{SERVER_PORT}/docs\")\n print(f\"MCP endpoint: http://{SERVER_HOST}:{SERVER_PORT}/mcp\")\n # Configure uvicorn to run the FastAPI app\n uvicorn.run(\n \"server:api_app\",\n host=SERVER_HOST,",
|
2045 |
+
"detail": "main",
|
2046 |
+
"documentation": {}
|
2047 |
+
},
|
2048 |
+
{
|
2049 |
+
"label": "SERVER_HOST",
|
2050 |
+
"kind": 5,
|
2051 |
+
"importPath": "main",
|
2052 |
+
"description": "main",
|
2053 |
+
"peekOfCode": "SERVER_HOST = os.getenv(\"MCP_HOST\", \"0.0.0.0\")\nSERVER_PORT = int(os.getenv(\"MCP_PORT\", \"8001\"))\nSERVER_TRANSPORT = os.getenv(\"MCP_TRANSPORT\", \"sse\")\ndef run_server():\n \"\"\"Run the MCP server with the configured settings.\"\"\"\n print(f\"Starting TutorX MCP server on {SERVER_HOST}:{SERVER_PORT}...\")\n print(f\"MCP transport: {SERVER_TRANSPORT}\")\n print(f\"API docs: http://{SERVER_HOST}:{SERVER_PORT}/docs\")\n print(f\"MCP endpoint: http://{SERVER_HOST}:{SERVER_PORT}/mcp\")\n # Configure uvicorn to run the FastAPI app",
|
2054 |
+
"detail": "main",
|
2055 |
+
"documentation": {}
|
2056 |
+
},
|
2057 |
+
{
|
2058 |
+
"label": "SERVER_PORT",
|
2059 |
+
"kind": 5,
|
2060 |
+
"importPath": "main",
|
2061 |
+
"description": "main",
|
2062 |
+
"peekOfCode": "SERVER_PORT = int(os.getenv(\"MCP_PORT\", \"8001\"))\nSERVER_TRANSPORT = os.getenv(\"MCP_TRANSPORT\", \"sse\")\ndef run_server():\n \"\"\"Run the MCP server with the configured settings.\"\"\"\n print(f\"Starting TutorX MCP server on {SERVER_HOST}:{SERVER_PORT}...\")\n print(f\"MCP transport: {SERVER_TRANSPORT}\")\n print(f\"API docs: http://{SERVER_HOST}:{SERVER_PORT}/docs\")\n print(f\"MCP endpoint: http://{SERVER_HOST}:{SERVER_PORT}/mcp\")\n # Configure uvicorn to run the FastAPI app\n uvicorn.run(",
|
2063 |
+
"detail": "main",
|
2064 |
+
"documentation": {}
|
2065 |
+
},
|
2066 |
+
{
|
2067 |
+
"label": "SERVER_TRANSPORT",
|
2068 |
+
"kind": 5,
|
2069 |
+
"importPath": "main",
|
2070 |
+
"description": "main",
|
2071 |
+
"peekOfCode": "SERVER_TRANSPORT = os.getenv(\"MCP_TRANSPORT\", \"sse\")\ndef run_server():\n \"\"\"Run the MCP server with the configured settings.\"\"\"\n print(f\"Starting TutorX MCP server on {SERVER_HOST}:{SERVER_PORT}...\")\n print(f\"MCP transport: {SERVER_TRANSPORT}\")\n print(f\"API docs: http://{SERVER_HOST}:{SERVER_PORT}/docs\")\n print(f\"MCP endpoint: http://{SERVER_HOST}:{SERVER_PORT}/mcp\")\n # Configure uvicorn to run the FastAPI app\n uvicorn.run(\n \"server:api_app\",",
|
2072 |
+
"detail": "main",
|
2073 |
+
"documentation": {}
|
2074 |
+
},
|
2075 |
+
{
|
2076 |
+
"label": "run_mcp_server",
|
2077 |
+
"kind": 2,
|
2078 |
+
"importPath": "run",
|
2079 |
+
"description": "run",
|
2080 |
+
"peekOfCode": "def run_mcp_server(host=\"0.0.0.0\", port=8001):\n \"\"\"\n Run the MCP server using uvicorn\n Args:\n host: Host to bind the server to\n port: Port to run the server on\n \"\"\"\n print(f\"Starting TutorX MCP Server on {host}:{port}...\")\n # Set environment variables\n os.environ[\"MCP_HOST\"] = host",
|
2081 |
+
"detail": "run",
|
2082 |
+
"documentation": {}
|
2083 |
+
},
|
2084 |
+
{
|
2085 |
+
"label": "run_gradio_interface",
|
2086 |
+
"kind": 2,
|
2087 |
+
"importPath": "run",
|
2088 |
+
"description": "run",
|
2089 |
+
"peekOfCode": "def run_gradio_interface(port=7860):\n \"\"\"\n Run the Gradio interface\n Args:\n port: Port to run the Gradio interface on\n \"\"\"\n print(f\"Starting TutorX Gradio Interface on port {port}...\")\n try:\n # Make sure the mcp-server directory is in the path\n mcp_server_dir = str(Path(__file__).parent / \"mcp-server\")",
|
2090 |
+
"detail": "run",
|
2091 |
+
"documentation": {}
|
2092 |
+
},
|
2093 |
+
{
|
2094 |
+
"label": "check_port_available",
|
2095 |
+
"kind": 2,
|
2096 |
+
"importPath": "run",
|
2097 |
+
"description": "run",
|
2098 |
+
"peekOfCode": "def check_port_available(port):\n \"\"\"\n Check if a port is available\n Args:\n port: Port number to check\n Returns:\n bool: True if port is available, False otherwise\n \"\"\"\n with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n return s.connect_ex(('localhost', port)) != 0",
|
2099 |
+
"detail": "run",
|
2100 |
+
"documentation": {}
|
2101 |
+
},
|
2102 |
+
{
|
2103 |
+
"label": "run_tests",
|
2104 |
+
"kind": 2,
|
2105 |
+
"importPath": "run_tests",
|
2106 |
+
"description": "run_tests",
|
2107 |
+
"peekOfCode": "def run_tests():\n \"\"\"Run all tests\"\"\"\n print(\"Running TutorX-MCP Tests...\")\n # First run unittest tests\n unittest_loader = unittest.TestLoader()\n test_directory = os.path.join(os.path.dirname(__file__), \"tests\")\n test_suite = unittest_loader.discover(test_directory)\n test_runner = unittest.TextTestRunner(verbosity=2)\n unittest_result = test_runner.run(test_suite)\n # Then run pytest tests (with coverage)",
|
2108 |
+
"detail": "run_tests",
|
2109 |
+
"documentation": {}
|
2110 |
+
}
|
2111 |
+
]
|
app.py
CHANGED
@@ -37,8 +37,7 @@ async def load_concept_graph(concept_id: str = None):
|
|
37 |
async with sse_client(SERVER_URL) as (sse, write):
|
38 |
async with ClientSession(sse, write) as session:
|
39 |
await session.initialize()
|
40 |
-
|
41 |
-
result = await session.call_resource("resources/read", {"uri": f"concept-graph://{concept_id}" if concept_id else "concept-graph://"})
|
42 |
print(f"[DEBUG] Server response: {result}")
|
43 |
if not result or not isinstance(result, dict):
|
44 |
error_msg = "Invalid server response"
|
@@ -68,16 +67,18 @@ async def load_concept_graph(concept_id: str = None):
|
|
68 |
related_concepts = []
|
69 |
if "related" in concept:
|
70 |
for rel_id in concept["related"]:
|
71 |
-
rel_result = await session.call_tool("
|
72 |
if "error" not in rel_result:
|
73 |
-
|
|
|
74 |
G.add_edge(concept["id"], rel_id, relationship="related_to")
|
75 |
-
related_concepts.append([rel_id,
|
76 |
if "prerequisites" in concept:
|
77 |
for prereq_id in concept["prerequisites"]:
|
78 |
-
prereq_result = await session.call_tool("
|
79 |
if "error" not in prereq_result:
|
80 |
-
|
|
|
81 |
G.add_edge(prereq_id, concept["id"], relationship="prerequisite_for")
|
82 |
plt.figure(figsize=(10, 8))
|
83 |
pos = nx.spring_layout(G)
|
@@ -97,13 +98,7 @@ async def load_concept_graph(concept_id: str = None):
|
|
97 |
nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels, font_size=8)
|
98 |
plt.title(f"Concept Graph: {concept.get('name', concept_id)}")
|
99 |
plt.axis("off")
|
100 |
-
concept_details =
|
101 |
-
"id": concept.get("id", ""),
|
102 |
-
"name": concept.get("name", ""),
|
103 |
-
"description": concept.get("description", ""),
|
104 |
-
"related_concepts_count": len(concept.get("related", [])),
|
105 |
-
"prerequisites_count": len(concept.get("prerequisites", []))
|
106 |
-
}
|
107 |
return plt.gcf(), concept_details, related_concepts
|
108 |
except Exception as e:
|
109 |
import traceback
|
@@ -129,10 +124,11 @@ with gr.Blocks(title="TutorX Educational AI", theme=gr.themes.Soft()) as demo:
|
|
129 |
gr.Markdown("## Concept Graph Visualization")
|
130 |
with gr.Row():
|
131 |
with gr.Column(scale=3):
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
136 |
interactive=True
|
137 |
)
|
138 |
load_concept_btn = gr.Button("Load Concept Graph", variant="primary")
|
@@ -154,14 +150,14 @@ with gr.Blocks(title="TutorX Educational AI", theme=gr.themes.Soft()) as demo:
|
|
154 |
# Button click handler
|
155 |
load_concept_btn.click(
|
156 |
fn=load_concept_graph,
|
157 |
-
inputs=[
|
158 |
outputs=[graph_output, concept_details, related_concepts]
|
159 |
)
|
160 |
|
161 |
# Load default concept on tab click
|
162 |
concept_graph_tab.load(
|
163 |
fn=load_concept_graph,
|
164 |
-
inputs=[
|
165 |
outputs=[graph_output, concept_details, related_concepts]
|
166 |
)
|
167 |
|
@@ -196,7 +192,6 @@ with gr.Blocks(title="TutorX Educational AI", theme=gr.themes.Soft()) as demo:
|
|
196 |
difficulty = max(1, min(5, difficulty))
|
197 |
except (ValueError, TypeError):
|
198 |
difficulty = 3
|
199 |
-
# Map numeric difficulty to string
|
200 |
if difficulty <= 2:
|
201 |
difficulty_str = "easy"
|
202 |
elif difficulty == 3:
|
@@ -247,59 +242,32 @@ with gr.Blocks(title="TutorX Educational AI", theme=gr.themes.Soft()) as demo:
|
|
247 |
outputs=[lesson_output]
|
248 |
)
|
249 |
|
250 |
-
gr.Markdown("##
|
251 |
-
|
252 |
with gr.Row():
|
253 |
with gr.Column():
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
)
|
259 |
-
standards_btn = gr.Button("Get Standards")
|
260 |
-
|
261 |
with gr.Column():
|
262 |
-
|
263 |
-
|
264 |
-
async def get_standards_async(country):
|
265 |
try:
|
266 |
-
# Convert display text to lowercase for the API
|
267 |
-
country_code = country.lower()
|
268 |
async with sse_client(SERVER_URL) as (sse, write):
|
269 |
async with ClientSession(sse, write) as session:
|
270 |
await session.initialize()
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
"subjects": {},
|
278 |
-
"website": response["standards"].get("website", "")
|
279 |
-
}
|
280 |
-
|
281 |
-
# Format subjects and domains
|
282 |
-
for subj_key, subj_info in response["standards"]["subjects"].items():
|
283 |
-
formatted["subjects"][subj_key] = {
|
284 |
-
"description": subj_info["description"],
|
285 |
-
"domains": subj_info["domains"]
|
286 |
-
}
|
287 |
-
|
288 |
-
# Add grade levels or key stages if available
|
289 |
-
if "grade_levels" in response["standards"]:
|
290 |
-
formatted["grade_levels"] = response["standards"]["grade_levels"]
|
291 |
-
elif "key_stages" in response["standards"]:
|
292 |
-
formatted["key_stages"] = response["standards"]["key_stages"]
|
293 |
-
|
294 |
-
return formatted
|
295 |
-
return response
|
296 |
except Exception as e:
|
297 |
-
return {"error":
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
outputs=[standards_output]
|
303 |
)
|
304 |
|
305 |
# Tab 3: Multi-Modal Interaction
|
@@ -326,40 +294,59 @@ with gr.Blocks(title="TutorX Educational AI", theme=gr.themes.Soft()) as demo:
|
|
326 |
outputs=[text_output]
|
327 |
)
|
328 |
|
329 |
-
|
|
|
330 |
with gr.Row():
|
331 |
with gr.Column():
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
with gr.Column():
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
if not pdf_file:
|
340 |
-
return {"error": "No PDF file provided", "success": False}
|
341 |
try:
|
342 |
-
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
else:
|
346 |
-
file_path =
|
347 |
-
|
348 |
if not file_path or not os.path.exists(file_path):
|
349 |
return {"error": "File not found", "success": False}
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
async with sse_client(SERVER_URL) as (sse, write):
|
352 |
async with ClientSession(sse, write) as session:
|
353 |
await session.initialize()
|
354 |
-
response = await session.call_tool("
|
355 |
return response
|
356 |
except Exception as e:
|
357 |
-
return {"error": f"Error processing
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
outputs=[summary_output]
|
363 |
)
|
364 |
|
365 |
# Tab 4: Analytics
|
@@ -387,7 +374,7 @@ with gr.Blocks(title="TutorX Educational AI", theme=gr.themes.Soft()) as demo:
|
|
387 |
async with sse_client(SERVER_URL) as (sse, write):
|
388 |
async with ClientSession(sse, write) as session:
|
389 |
await session.initialize()
|
390 |
-
response = await session.call_tool("check_submission_originality", {"submission": submission, "reference_sources": reference})
|
391 |
return response
|
392 |
|
393 |
plagiarism_btn.click(
|
|
|
37 |
async with sse_client(SERVER_URL) as (sse, write):
|
38 |
async with ClientSession(sse, write) as session:
|
39 |
await session.initialize()
|
40 |
+
result = await session.call_tool("get_concept_graph_tool", {"concept_id": concept_id} if concept_id else {})
|
|
|
41 |
print(f"[DEBUG] Server response: {result}")
|
42 |
if not result or not isinstance(result, dict):
|
43 |
error_msg = "Invalid server response"
|
|
|
67 |
related_concepts = []
|
68 |
if "related" in concept:
|
69 |
for rel_id in concept["related"]:
|
70 |
+
rel_result = await session.call_tool("get_concept_graph_tool", {"concept_id": rel_id})
|
71 |
if "error" not in rel_result:
|
72 |
+
rel_concept = rel_result.get("concept", {})
|
73 |
+
G.add_node(rel_id, label=rel_concept.get("name", rel_id), type="related")
|
74 |
G.add_edge(concept["id"], rel_id, relationship="related_to")
|
75 |
+
related_concepts.append([rel_id, rel_concept.get("name", ""), rel_concept.get("description", "")])
|
76 |
if "prerequisites" in concept:
|
77 |
for prereq_id in concept["prerequisites"]:
|
78 |
+
prereq_result = await session.call_tool("get_concept_graph_tool", {"concept_id": prereq_id})
|
79 |
if "error" not in prereq_result:
|
80 |
+
prereq_concept = prereq_result.get("concept", {})
|
81 |
+
G.add_node(prereq_id, label=prereq_concept.get("name", prereq_id), type="prerequisite")
|
82 |
G.add_edge(prereq_id, concept["id"], relationship="prerequisite_for")
|
83 |
plt.figure(figsize=(10, 8))
|
84 |
pos = nx.spring_layout(G)
|
|
|
98 |
nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels, font_size=8)
|
99 |
plt.title(f"Concept Graph: {concept.get('name', concept_id)}")
|
100 |
plt.axis("off")
|
101 |
+
concept_details = concept
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
return plt.gcf(), concept_details, related_concepts
|
103 |
except Exception as e:
|
104 |
import traceback
|
|
|
124 |
gr.Markdown("## Concept Graph Visualization")
|
125 |
with gr.Row():
|
126 |
with gr.Column(scale=3):
|
127 |
+
# Change from dropdown to textbox for concept input
|
128 |
+
concept_input_box = gr.Textbox(
|
129 |
+
label="Enter Concept Name",
|
130 |
+
placeholder="e.g., python, functions, oop, data_structures",
|
131 |
+
lines=1,
|
132 |
interactive=True
|
133 |
)
|
134 |
load_concept_btn = gr.Button("Load Concept Graph", variant="primary")
|
|
|
150 |
# Button click handler
|
151 |
load_concept_btn.click(
|
152 |
fn=load_concept_graph,
|
153 |
+
inputs=[concept_input_box],
|
154 |
outputs=[graph_output, concept_details, related_concepts]
|
155 |
)
|
156 |
|
157 |
# Load default concept on tab click
|
158 |
concept_graph_tab.load(
|
159 |
fn=load_concept_graph,
|
160 |
+
inputs=[concept_input_box],
|
161 |
outputs=[graph_output, concept_details, related_concepts]
|
162 |
)
|
163 |
|
|
|
192 |
difficulty = max(1, min(5, difficulty))
|
193 |
except (ValueError, TypeError):
|
194 |
difficulty = 3
|
|
|
195 |
if difficulty <= 2:
|
196 |
difficulty_str = "easy"
|
197 |
elif difficulty == 3:
|
|
|
242 |
outputs=[lesson_output]
|
243 |
)
|
244 |
|
245 |
+
gr.Markdown("## Learning Path Generation")
|
|
|
246 |
with gr.Row():
|
247 |
with gr.Column():
|
248 |
+
lp_student_id = gr.Textbox(label="Student ID", value=student_id)
|
249 |
+
lp_concept_ids = gr.Textbox(label="Concept IDs (comma-separated)", placeholder="e.g., python,functions,oop")
|
250 |
+
lp_student_level = gr.Dropdown(choices=["beginner", "intermediate", "advanced"], value="beginner", label="Student Level")
|
251 |
+
lp_btn = gr.Button("Generate Learning Path")
|
|
|
|
|
|
|
252 |
with gr.Column():
|
253 |
+
lp_output = gr.JSON(label="Learning Path")
|
254 |
+
async def on_generate_learning_path(student_id, concept_ids, student_level):
|
|
|
255 |
try:
|
|
|
|
|
256 |
async with sse_client(SERVER_URL) as (sse, write):
|
257 |
async with ClientSession(sse, write) as session:
|
258 |
await session.initialize()
|
259 |
+
result = await session.call_tool("get_learning_path", {
|
260 |
+
"student_id": student_id,
|
261 |
+
"concept_ids": [c.strip() for c in concept_ids.split(",") if c.strip()],
|
262 |
+
"student_level": student_level
|
263 |
+
})
|
264 |
+
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
except Exception as e:
|
266 |
+
return {"error": str(e)}
|
267 |
+
lp_btn.click(
|
268 |
+
fn=on_generate_learning_path,
|
269 |
+
inputs=[lp_student_id, lp_concept_ids, lp_student_level],
|
270 |
+
outputs=[lp_output]
|
|
|
271 |
)
|
272 |
|
273 |
# Tab 3: Multi-Modal Interaction
|
|
|
294 |
outputs=[text_output]
|
295 |
)
|
296 |
|
297 |
+
# Document OCR (PDF, images, etc.)
|
298 |
+
gr.Markdown("## Document OCR & LLM Analysis")
|
299 |
with gr.Row():
|
300 |
with gr.Column():
|
301 |
+
doc_input = gr.File(label="Upload PDF or Document", file_types=[".pdf", ".jpg", ".jpeg", ".png"])
|
302 |
+
doc_ocr_btn = gr.Button("Extract Text & Analyze")
|
|
|
303 |
with gr.Column():
|
304 |
+
doc_output = gr.JSON(label="Document OCR & LLM Analysis")
|
305 |
+
async def upload_file_to_storage(file_path):
|
306 |
+
"""Helper function to upload file to storage API"""
|
|
|
|
|
307 |
try:
|
308 |
+
url = "https://storage-bucket-api.vercel.app/upload"
|
309 |
+
with open(file_path, 'rb') as f:
|
310 |
+
files = {'file': (os.path.basename(file_path), f)}
|
311 |
+
response = requests.post(url, files=files)
|
312 |
+
response.raise_for_status()
|
313 |
+
return response.json()
|
314 |
+
except Exception as e:
|
315 |
+
return {"error": f"Error uploading file to storage: {str(e)}", "success": False}
|
316 |
+
|
317 |
+
async def document_ocr_async(file):
|
318 |
+
if not file:
|
319 |
+
return {"error": "No file provided", "success": False}
|
320 |
+
try:
|
321 |
+
if isinstance(file, dict):
|
322 |
+
file_path = file.get("path", "")
|
323 |
else:
|
324 |
+
file_path = file
|
|
|
325 |
if not file_path or not os.path.exists(file_path):
|
326 |
return {"error": "File not found", "success": False}
|
327 |
+
|
328 |
+
# Upload file to storage API
|
329 |
+
upload_result = await upload_file_to_storage(file_path)
|
330 |
+
if not upload_result.get("success"):
|
331 |
+
return upload_result
|
332 |
+
|
333 |
+
# Get the storage URL from the upload response
|
334 |
+
storage_url = upload_result.get("storage_url")
|
335 |
+
if not storage_url:
|
336 |
+
return {"error": "No storage URL returned from upload", "success": False}
|
337 |
+
|
338 |
+
# Use the storage URL for OCR processing
|
339 |
async with sse_client(SERVER_URL) as (sse, write):
|
340 |
async with ClientSession(sse, write) as session:
|
341 |
await session.initialize()
|
342 |
+
response = await session.call_tool("mistral_document_ocr", {"document_url": storage_url})
|
343 |
return response
|
344 |
except Exception as e:
|
345 |
+
return {"error": f"Error processing document: {str(e)}", "success": False}
|
346 |
+
doc_ocr_btn.click(
|
347 |
+
fn=document_ocr_async,
|
348 |
+
inputs=[doc_input],
|
349 |
+
outputs=[doc_output]
|
|
|
350 |
)
|
351 |
|
352 |
# Tab 4: Analytics
|
|
|
374 |
async with sse_client(SERVER_URL) as (sse, write):
|
375 |
async with ClientSession(sse, write) as session:
|
376 |
await session.initialize()
|
377 |
+
response = await session.call_tool("check_submission_originality", {"submission": submission, "reference_sources": [reference] if isinstance(reference, str) else reference})
|
378 |
return response
|
379 |
|
380 |
plagiarism_btn.click(
|
mcp_server/server.py
CHANGED
@@ -110,22 +110,43 @@ async def check_originality_endpoint(request: dict):
|
|
110 |
raise HTTPException(status_code=400, detail="submission (string) and reference_sources (array) are required")
|
111 |
return await interaction_tools.check_submission_originality(submission, reference_sources)
|
112 |
|
113 |
-
# API endpoints -
|
114 |
-
@api_app.post("/api/
|
115 |
-
async def
|
116 |
-
file: UploadFile = File(...)
|
117 |
-
filename: str = Form(None)
|
118 |
):
|
119 |
try:
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
except Exception as e:
|
128 |
-
raise HTTPException(status_code=500, detail=str(e))
|
129 |
|
130 |
# API endpoints - Learning Path
|
131 |
@api_app.post("/api/learning-path")
|
|
|
110 |
raise HTTPException(status_code=400, detail="submission (string) and reference_sources (array) are required")
|
111 |
return await interaction_tools.check_submission_originality(submission, reference_sources)
|
112 |
|
113 |
+
# API endpoints - Document OCR
|
114 |
+
@api_app.post("/api/document-ocr")
|
115 |
+
async def document_ocr_endpoint(
|
116 |
+
file: UploadFile = File(...)
|
|
|
117 |
):
|
118 |
try:
|
119 |
+
# Save the uploaded file to a temporary location
|
120 |
+
import tempfile
|
121 |
+
import os
|
122 |
+
|
123 |
+
# Get the file extension
|
124 |
+
file_extension = os.path.splitext(file.filename)[1].lower()
|
125 |
+
|
126 |
+
# Create a temporary file with the same extension
|
127 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=file_extension) as temp_file:
|
128 |
+
content = await file.read()
|
129 |
+
temp_file.write(content)
|
130 |
+
temp_file_path = temp_file.name
|
131 |
+
|
132 |
+
try:
|
133 |
+
# Upload the file to storage and get the URL
|
134 |
+
from mcp_server.utils.azure_upload import upload_to_azure
|
135 |
+
document_url = upload_to_azure(temp_file_path)
|
136 |
+
|
137 |
+
# Process the document with OCR
|
138 |
+
result = await ocr_tools.mistral_document_ocr(document_url)
|
139 |
+
return result
|
140 |
+
|
141 |
+
finally:
|
142 |
+
# Clean up the temporary file
|
143 |
+
try:
|
144 |
+
os.unlink(temp_file_path)
|
145 |
+
except:
|
146 |
+
pass
|
147 |
+
|
148 |
except Exception as e:
|
149 |
+
raise HTTPException(status_code=500, detail=f"Error processing document: {str(e)}")
|
150 |
|
151 |
# API endpoints - Learning Path
|
152 |
@api_app.post("/api/learning-path")
|
mcp_server/tools/__init__.py
CHANGED
@@ -10,7 +10,7 @@ from .concept_graph_tools import get_concept_graph_tool # noqa
|
|
10 |
from .lesson_tools import generate_lesson_tool # noqa
|
11 |
from .quiz_tools import generate_quiz_tool # noqa
|
12 |
from .interaction_tools import text_interaction, check_submission_originality # noqa
|
13 |
-
from .ocr_tools import
|
14 |
from .learning_path_tools import get_learning_path # noqa
|
15 |
|
16 |
__all__ = [
|
@@ -30,8 +30,7 @@ __all__ = [
|
|
30 |
'check_submission_originality',
|
31 |
|
32 |
# OCR tools
|
33 |
-
'
|
34 |
-
'image_to_text',
|
35 |
|
36 |
# Learning path tools
|
37 |
'get_learning_path',
|
|
|
10 |
from .lesson_tools import generate_lesson_tool # noqa
|
11 |
from .quiz_tools import generate_quiz_tool # noqa
|
12 |
from .interaction_tools import text_interaction, check_submission_originality # noqa
|
13 |
+
from .ocr_tools import mistral_document_ocr # noqa
|
14 |
from .learning_path_tools import get_learning_path # noqa
|
15 |
|
16 |
__all__ = [
|
|
|
30 |
'check_submission_originality',
|
31 |
|
32 |
# OCR tools
|
33 |
+
'mistral_document_ocr',
|
|
|
34 |
|
35 |
# Learning path tools
|
36 |
'get_learning_path',
|
mcp_server/tools/concept_graph_tools.py
CHANGED
@@ -5,6 +5,7 @@ from typing import Dict, Any, Optional
|
|
5 |
import sys
|
6 |
import os
|
7 |
from pathlib import Path
|
|
|
8 |
|
9 |
# Add the parent directory to the Python path
|
10 |
current_dir = Path(__file__).parent
|
@@ -25,22 +26,29 @@ from resources import concept_graph
|
|
25 |
|
26 |
# Import MCP
|
27 |
from mcp_server.mcp_instance import mcp
|
|
|
|
|
|
|
28 |
|
29 |
@mcp.tool()
|
30 |
-
async def get_concept_graph_tool(concept_id: Optional[str] = None) ->
|
31 |
"""
|
32 |
-
Get the complete concept graph or a specific concept.
|
33 |
-
|
34 |
-
|
35 |
-
concept_id: Optional concept ID to get a specific concept
|
36 |
-
|
37 |
-
Returns:
|
38 |
-
Dictionary containing the concept graph or a specific concept
|
39 |
"""
|
40 |
if concept_id:
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import sys
|
6 |
import os
|
7 |
from pathlib import Path
|
8 |
+
import json
|
9 |
|
10 |
# Add the parent directory to the Python path
|
11 |
current_dir = Path(__file__).parent
|
|
|
26 |
|
27 |
# Import MCP
|
28 |
from mcp_server.mcp_instance import mcp
|
29 |
+
from mcp_server.model.gemini_flash import GeminiFlash
|
30 |
+
|
31 |
+
MODEL = GeminiFlash()
|
32 |
|
33 |
@mcp.tool()
|
34 |
+
async def get_concept_graph_tool(concept_id: Optional[str] = None) -> dict:
|
35 |
"""
|
36 |
+
Get the complete concept graph or a specific concept, fully LLM-driven.
|
37 |
+
For a specific concept, use Gemini to generate a JSON object with explanation, related concepts, prerequisites, and summary.
|
38 |
+
For the full graph, use Gemini to generate a JSON object with a list of all concepts and their relationships.
|
|
|
|
|
|
|
|
|
39 |
"""
|
40 |
if concept_id:
|
41 |
+
prompt = (
|
42 |
+
f"Provide a JSON object for the concept '{concept_id}' with fields: explanation (string), related_concepts (list of strings), prerequisites (list of strings), and summary (string)."
|
43 |
+
)
|
44 |
+
else:
|
45 |
+
prompt = (
|
46 |
+
"Provide a JSON object with a list of all concepts in a knowledge graph. "
|
47 |
+
"Each concept should have fields: id, name, description, related_concepts (list), prerequisites (list)."
|
48 |
+
)
|
49 |
+
llm_response = await MODEL.generate_text(prompt)
|
50 |
+
try:
|
51 |
+
data = json.loads(llm_response)
|
52 |
+
except Exception:
|
53 |
+
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
54 |
+
return data
|
mcp_server/tools/concept_tools.py
CHANGED
@@ -7,6 +7,7 @@ from datetime import datetime, timezone
|
|
7 |
import sys
|
8 |
import os
|
9 |
from pathlib import Path
|
|
|
10 |
|
11 |
# Add the parent directory to the Python path
|
12 |
current_dir = Path(__file__).parent
|
@@ -27,74 +28,42 @@ from resources.concept_graph import get_concept, get_all_concepts
|
|
27 |
|
28 |
# Import MCP
|
29 |
from mcp_server.mcp_instance import mcp
|
|
|
|
|
|
|
30 |
|
31 |
@mcp.tool()
|
32 |
-
async def get_concept_tool(concept_id: str = None) ->
|
33 |
"""
|
34 |
-
Get a specific concept or all concepts from the knowledge graph.
|
35 |
-
|
36 |
-
Args:
|
37 |
-
concept_id: Optional concept ID to retrieve a specific concept
|
38 |
-
|
39 |
-
Returns:
|
40 |
-
Dictionary containing the requested concept(s)
|
41 |
"""
|
42 |
-
if concept_id:
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
@mcp.tool()
|
50 |
-
async def assess_skill_tool(student_id: str, concept_id: str) ->
|
51 |
"""
|
52 |
-
Assess a student's understanding of a specific concept.
|
53 |
-
|
54 |
-
Args:
|
55 |
-
student_id: Unique identifier for the student
|
56 |
-
concept_id: ID of the concept to assess
|
57 |
-
|
58 |
-
Returns:
|
59 |
-
Dictionary containing assessment results
|
60 |
"""
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
# Set timestamp with timezone
|
72 |
-
timestamp = datetime.now(timezone.utc).isoformat()
|
73 |
-
|
74 |
-
# Generate feedback based on score
|
75 |
-
feedback = {
|
76 |
-
"strengths": [f"Good understanding of {concept_name} fundamentals"],
|
77 |
-
"areas_for_improvement": [f"Could work on advanced applications of {concept_name}"],
|
78 |
-
"recommendations": [
|
79 |
-
f"Review {concept_name} practice problems",
|
80 |
-
f"Watch tutorial videos on {concept_name}"
|
81 |
-
]
|
82 |
-
}
|
83 |
-
|
84 |
-
# Adjust feedback based on score
|
85 |
-
if score < 0.5:
|
86 |
-
feedback["strengths"] = [f"Basic understanding of {concept_name}"]
|
87 |
-
feedback["areas_for_improvement"] = [
|
88 |
-
f"Needs to strengthen fundamental knowledge of {concept_name}",
|
89 |
-
f"Practice more exercises on {concept_name}"
|
90 |
-
]
|
91 |
-
|
92 |
-
# Return assessment results
|
93 |
-
return {
|
94 |
-
"student_id": student_id,
|
95 |
-
"concept_id": concept_id,
|
96 |
-
"concept_name": concept_name,
|
97 |
-
"score": round(score, 2), # Round to 2 decimal places
|
98 |
-
"timestamp": timestamp,
|
99 |
-
"feedback": feedback
|
100 |
-
}
|
|
|
7 |
import sys
|
8 |
import os
|
9 |
from pathlib import Path
|
10 |
+
import json
|
11 |
|
12 |
# Add the parent directory to the Python path
|
13 |
current_dir = Path(__file__).parent
|
|
|
28 |
|
29 |
# Import MCP
|
30 |
from mcp_server.mcp_instance import mcp
|
31 |
+
from mcp_server.model.gemini_flash import GeminiFlash
|
32 |
+
|
33 |
+
MODEL = GeminiFlash()
|
34 |
|
35 |
@mcp.tool()
|
36 |
+
async def get_concept_tool(concept_id: str = None) -> dict:
|
37 |
"""
|
38 |
+
Get a specific concept or all concepts from the knowledge graph, fully LLM-driven.
|
39 |
+
If a concept_id is provided, use Gemini to generate a JSON object with explanation, key points, and example.
|
|
|
|
|
|
|
|
|
|
|
40 |
"""
|
41 |
+
if not concept_id:
|
42 |
+
return {"error": "concept_id is required for LLM-driven mode"}
|
43 |
+
prompt = (
|
44 |
+
f"Explain the concept '{concept_id}' in detail. "
|
45 |
+
f"Return a JSON object with fields: explanation (string), key_points (list of strings), and example (string)."
|
46 |
+
)
|
47 |
+
llm_response = await MODEL.generate_text(prompt)
|
48 |
+
try:
|
49 |
+
data = json.loads(llm_response)
|
50 |
+
except Exception:
|
51 |
+
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
52 |
+
return data
|
53 |
|
54 |
@mcp.tool()
|
55 |
+
async def assess_skill_tool(student_id: str, concept_id: str) -> dict:
|
56 |
"""
|
57 |
+
Assess a student's understanding of a specific concept, fully LLM-driven.
|
58 |
+
Use Gemini to generate a JSON object with a score (0-1), feedback, and recommendations.
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
"""
|
60 |
+
prompt = (
|
61 |
+
f"A student (ID: {student_id}) is being assessed on the concept '{concept_id}'. "
|
62 |
+
f"Generate a JSON object with: score (float 0-1), feedback (string), and recommendations (list of strings)."
|
63 |
+
)
|
64 |
+
llm_response = await MODEL.generate_text(prompt)
|
65 |
+
try:
|
66 |
+
data = json.loads(llm_response)
|
67 |
+
except Exception:
|
68 |
+
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
69 |
+
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mcp_server/tools/interaction_tools.py
CHANGED
@@ -5,123 +5,45 @@ import re
|
|
5 |
from difflib import SequenceMatcher
|
6 |
from typing import Dict, Any, List, Optional
|
7 |
from mcp_server.mcp_instance import mcp
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def calculate_similarity(text1: str, text2: str) -> float:
|
10 |
"""Calculate the similarity ratio between two texts."""
|
11 |
-
return
|
12 |
|
13 |
@mcp.tool()
|
14 |
-
async def text_interaction(query: str, student_id: str) ->
|
15 |
"""
|
16 |
-
Process a text query from a student and provide an educational response.
|
17 |
-
|
18 |
-
Args:
|
19 |
-
query: The student's question or input text
|
20 |
-
student_id: Unique identifier for the student
|
21 |
-
|
22 |
-
Returns:
|
23 |
-
Dictionary containing the response and metadata
|
24 |
"""
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
"Take a quiz"
|
36 |
-
]
|
37 |
-
}
|
38 |
-
|
39 |
-
# Check for help request
|
40 |
-
if "help" in query_lower or "confused" in query_lower:
|
41 |
-
return {
|
42 |
-
"response": "I'm here to help! Could you please tell me what specific topic or concept you're struggling with?",
|
43 |
-
"suggested_actions": [
|
44 |
-
"Explain functions in Python",
|
45 |
-
"What is object-oriented programming?",
|
46 |
-
"Help me debug my code"
|
47 |
-
]
|
48 |
-
}
|
49 |
-
|
50 |
-
# Default response for other queries
|
51 |
-
return {
|
52 |
-
"response": f"I understand you're asking about: {query}. Here's what I can tell you...",
|
53 |
-
"metadata": {
|
54 |
-
"student_id": student_id,
|
55 |
-
"query_type": "general_inquiry"
|
56 |
-
},
|
57 |
-
"suggested_resources": [
|
58 |
-
{"title": "Related Documentation", "url": "https://docs.python.org/3/"},
|
59 |
-
{"title": "Tutorial Video", "url": "https://www.youtube.com/"},
|
60 |
-
{"title": "Practice Exercises", "url": "https://www.hackerrank.com/"}
|
61 |
-
]
|
62 |
-
}
|
63 |
|
64 |
@mcp.tool()
|
65 |
-
async def check_submission_originality(submission: str, reference_sources:
|
66 |
"""
|
67 |
-
Check a student's submission for potential plagiarism
|
68 |
-
|
69 |
-
Args:
|
70 |
-
submission: The student's submission text
|
71 |
-
reference_sources: List of reference texts to check against
|
72 |
-
|
73 |
-
Returns:
|
74 |
-
Dictionary with originality analysis results
|
75 |
"""
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
results.append({
|
87 |
-
"source_index": i,
|
88 |
-
"similarity_score": round(similarity, 4),
|
89 |
-
"is_original": similarity < 0.7, # Threshold for originality
|
90 |
-
"suspicious_sections": []
|
91 |
-
})
|
92 |
-
|
93 |
-
# Check for exact matches
|
94 |
-
exact_matches = []
|
95 |
-
submission_words = submission.split()
|
96 |
-
for i in range(len(submission_words) - 4): # Check 5-word sequences
|
97 |
-
seq = ' '.join(submission_words[i:i+5])
|
98 |
-
for j, source in enumerate(reference_sources):
|
99 |
-
if seq in source:
|
100 |
-
exact_matches.append({
|
101 |
-
"source_index": j + 1,
|
102 |
-
"matched_text": seq,
|
103 |
-
"position": i
|
104 |
-
})
|
105 |
-
|
106 |
-
# Calculate overall originality score (weighted average)
|
107 |
-
if results:
|
108 |
-
avg_similarity = sum(r["similarity_score"] for r in results) / len(results)
|
109 |
-
originality_score = max(0, 1 - avg_similarity)
|
110 |
-
else:
|
111 |
-
originality_score = 1.0
|
112 |
-
|
113 |
-
return {
|
114 |
-
"originality_score": round(originality_score, 2),
|
115 |
-
"is_original": all(r["is_original"] for r in results) if results else True,
|
116 |
-
"sources_checked": len(reference_sources),
|
117 |
-
"source_comparisons": results,
|
118 |
-
"exact_matches": exact_matches,
|
119 |
-
"recommendations": [
|
120 |
-
"Paraphrase any sections with high similarity scores",
|
121 |
-
"Add proper citations for referenced material",
|
122 |
-
"Use your own words to explain concepts"
|
123 |
-
] if any(not r["is_original"] for r in results) else [
|
124 |
-
"Good job! Your work appears to be original.",
|
125 |
-
"Remember to always cite your sources properly."
|
126 |
-
]
|
127 |
-
}
|
|
|
5 |
from difflib import SequenceMatcher
|
6 |
from typing import Dict, Any, List, Optional
|
7 |
from mcp_server.mcp_instance import mcp
|
8 |
+
from mcp_server.model.gemini_flash import GeminiFlash
|
9 |
+
import json
|
10 |
+
|
11 |
+
MODEL = GeminiFlash()
|
12 |
|
13 |
def calculate_similarity(text1: str, text2: str) -> float:
|
14 |
"""Calculate the similarity ratio between two texts."""
|
15 |
+
return 0.0 # No longer used, LLM-driven
|
16 |
|
17 |
@mcp.tool()
|
18 |
+
async def text_interaction(query: str, student_id: str) -> dict:
|
19 |
"""
|
20 |
+
Process a text query from a student and provide an educational response, fully LLM-driven.
|
21 |
+
Use Gemini to generate a JSON object with a response and suggested actions/resources.
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
"""
|
23 |
+
prompt = (
|
24 |
+
f"A student (ID: {student_id}) asked: '{query}'. "
|
25 |
+
f"Return a JSON object with fields: response (string), suggested_actions (list of strings), and suggested_resources (list of strings)."
|
26 |
+
)
|
27 |
+
llm_response = await MODEL.generate_text(prompt)
|
28 |
+
try:
|
29 |
+
data = json.loads(llm_response)
|
30 |
+
except Exception:
|
31 |
+
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
32 |
+
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
@mcp.tool()
|
35 |
+
async def check_submission_originality(submission: str, reference_sources: list) -> dict:
|
36 |
"""
|
37 |
+
Check a student's submission for potential plagiarism, fully LLM-driven.
|
38 |
+
Use Gemini to generate a JSON object with originality_score (0-1), is_original (bool), and recommendations (list of strings).
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
"""
|
40 |
+
prompt = (
|
41 |
+
f"Given the following student submission: '{submission}' and reference sources: {reference_sources}, "
|
42 |
+
f"return a JSON object with fields: originality_score (float 0-1), is_original (bool), and recommendations (list of strings)."
|
43 |
+
)
|
44 |
+
llm_response = await MODEL.generate_text(prompt)
|
45 |
+
try:
|
46 |
+
data = json.loads(llm_response)
|
47 |
+
except Exception:
|
48 |
+
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
49 |
+
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mcp_server/tools/learning_path_tools.py
CHANGED
@@ -7,6 +7,7 @@ from datetime import datetime, timedelta
|
|
7 |
import sys
|
8 |
import os
|
9 |
from pathlib import Path
|
|
|
10 |
|
11 |
# Add the parent directory to the Python path
|
12 |
current_dir = Path(__file__).parent
|
@@ -27,6 +28,9 @@ from resources.concept_graph import CONCEPT_GRAPH
|
|
27 |
|
28 |
# Import MCP
|
29 |
from mcp_server.mcp_instance import mcp
|
|
|
|
|
|
|
30 |
|
31 |
def get_prerequisites(concept_id: str, visited: Optional[set] = None) -> List[Dict[str, Any]]:
|
32 |
"""
|
@@ -143,20 +147,18 @@ def generate_learning_path(concept_ids: List[str], student_level: str = "beginne
|
|
143 |
}
|
144 |
|
145 |
@mcp.tool()
|
146 |
-
async def get_learning_path(student_id: str, concept_ids:
|
147 |
"""
|
148 |
-
Generate a personalized learning path for a student.
|
149 |
-
|
150 |
-
Args:
|
151 |
-
student_id: Unique identifier for the student
|
152 |
-
concept_ids: List of concept IDs to include in the learning path
|
153 |
-
student_level: Optional student level (beginner, intermediate, advanced)
|
154 |
-
|
155 |
-
Returns:
|
156 |
-
Dictionary containing the learning path
|
157 |
"""
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
7 |
import sys
|
8 |
import os
|
9 |
from pathlib import Path
|
10 |
+
import json
|
11 |
|
12 |
# Add the parent directory to the Python path
|
13 |
current_dir = Path(__file__).parent
|
|
|
28 |
|
29 |
# Import MCP
|
30 |
from mcp_server.mcp_instance import mcp
|
31 |
+
from mcp_server.model.gemini_flash import GeminiFlash
|
32 |
+
|
33 |
+
MODEL = GeminiFlash()
|
34 |
|
35 |
def get_prerequisites(concept_id: str, visited: Optional[set] = None) -> List[Dict[str, Any]]:
|
36 |
"""
|
|
|
147 |
}
|
148 |
|
149 |
@mcp.tool()
|
150 |
+
async def get_learning_path(student_id: str, concept_ids: list, student_level: str = "beginner") -> dict:
|
151 |
"""
|
152 |
+
Generate a personalized learning path for a student, fully LLM-driven.
|
153 |
+
Use Gemini to generate a JSON object with a list of steps, each with concept name, description, estimated time, and recommended resources.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
"""
|
155 |
+
prompt = (
|
156 |
+
f"A student (ID: {student_id}) with level '{student_level}' needs a learning path for these concepts: {concept_ids}. "
|
157 |
+
f"Return a JSON object with a 'learning_path' field: a list of steps, each with concept_name, description, estimated_time_minutes, and resources (list)."
|
158 |
+
)
|
159 |
+
llm_response = await MODEL.generate_text(prompt)
|
160 |
+
try:
|
161 |
+
data = json.loads(llm_response)
|
162 |
+
except Exception:
|
163 |
+
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
164 |
+
return data
|
mcp_server/tools/lesson_tools.py
CHANGED
@@ -3,121 +3,24 @@ Lesson generation tools for TutorX MCP.
|
|
3 |
"""
|
4 |
from typing import Dict, Any, List
|
5 |
from mcp_server.mcp_instance import mcp
|
|
|
|
|
|
|
|
|
6 |
|
7 |
@mcp.tool()
|
8 |
-
async def generate_lesson_tool(topic: str, grade_level: int, duration_minutes: int) ->
|
9 |
"""
|
10 |
-
Generate a lesson plan for the given topic, grade level, and duration.
|
11 |
-
|
12 |
-
Args:
|
13 |
-
topic: The topic for the lesson
|
14 |
-
grade_level: The grade level (1-12)
|
15 |
-
duration_minutes: Duration of the lesson in minutes
|
16 |
-
|
17 |
-
Returns:
|
18 |
-
Dictionary containing the generated lesson plan
|
19 |
"""
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
# Calculate time allocation (example: 10% intro, 30% instruction, 40% practice, 20% review)
|
31 |
-
intro_time = max(5, duration_minutes * 0.1) # At least 5 minutes
|
32 |
-
instruction_time = duration_minutes * 0.3
|
33 |
-
practice_time = duration_minutes * 0.4
|
34 |
-
review_time = duration_minutes - (intro_time + instruction_time + practice_time)
|
35 |
-
|
36 |
-
# Generate learning objectives based on grade level and topic
|
37 |
-
difficulty = {
|
38 |
-
1: "basic",
|
39 |
-
2: "basic",
|
40 |
-
3: "basic",
|
41 |
-
4: "intermediate",
|
42 |
-
5: "intermediate",
|
43 |
-
6: "intermediate",
|
44 |
-
7: "advanced",
|
45 |
-
8: "advanced",
|
46 |
-
9: "advanced",
|
47 |
-
10: "expert",
|
48 |
-
11: "expert",
|
49 |
-
12: "expert"
|
50 |
-
}.get(grade_level, "intermediate")
|
51 |
-
|
52 |
-
# Create lesson plan
|
53 |
-
lesson_plan = {
|
54 |
-
"topic": topic,
|
55 |
-
"grade_level": grade_level,
|
56 |
-
"duration_minutes": duration_minutes,
|
57 |
-
"difficulty": difficulty,
|
58 |
-
"objectives": [
|
59 |
-
f"Understand the {difficulty} concepts of {topic}",
|
60 |
-
f"Apply {topic} concepts to solve problems",
|
61 |
-
f"Analyze and evaluate {topic} in different contexts"
|
62 |
-
],
|
63 |
-
"materials": [
|
64 |
-
"Whiteboard and markers",
|
65 |
-
"Printed worksheets",
|
66 |
-
"Example code snippets",
|
67 |
-
"Interactive coding environment"
|
68 |
-
],
|
69 |
-
"activities": [
|
70 |
-
{
|
71 |
-
"type": "introduction",
|
72 |
-
"duration_minutes": intro_time,
|
73 |
-
"description": f"Introduce the topic of {topic} and its importance"
|
74 |
-
},
|
75 |
-
{
|
76 |
-
"type": "direct_instruction",
|
77 |
-
"duration_minutes": instruction_time,
|
78 |
-
"description": f"Teach the core concepts of {topic}"
|
79 |
-
},
|
80 |
-
{
|
81 |
-
"type": "guided_practice",
|
82 |
-
"duration_minutes": practice_time,
|
83 |
-
"description": "Work through examples together"
|
84 |
-
},
|
85 |
-
{
|
86 |
-
"type": "independent_practice",
|
87 |
-
"duration_minutes": practice_time,
|
88 |
-
"description": "Students work on exercises independently"
|
89 |
-
},
|
90 |
-
{
|
91 |
-
"type": "review",
|
92 |
-
"duration_minutes": review_time,
|
93 |
-
"description": "Review key concepts and answer questions"
|
94 |
-
}
|
95 |
-
],
|
96 |
-
"assessment": {
|
97 |
-
"type": "formative",
|
98 |
-
"methods": ["Exit ticket", "Class participation", "Worksheet completion"]
|
99 |
-
},
|
100 |
-
"differentiation": {
|
101 |
-
"for_struggling_students": [
|
102 |
-
"Provide additional examples",
|
103 |
-
"Offer one-on-one support",
|
104 |
-
"Use visual aids"
|
105 |
-
],
|
106 |
-
"for_advanced_students": [
|
107 |
-
"Provide extension activities",
|
108 |
-
"Challenge with advanced problems",
|
109 |
-
"Encourage to help peers"
|
110 |
-
]
|
111 |
-
},
|
112 |
-
"homework": {
|
113 |
-
"description": f"Complete practice problems on {topic}",
|
114 |
-
"estimated_time_minutes": 20,
|
115 |
-
"resources": [
|
116 |
-
f"{topic} practice worksheet",
|
117 |
-
"Online practice problems",
|
118 |
-
"Reading assignment"
|
119 |
-
]
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
return lesson_plan
|
|
|
3 |
"""
|
4 |
from typing import Dict, Any, List
|
5 |
from mcp_server.mcp_instance import mcp
|
6 |
+
from mcp_server.model.gemini_flash import GeminiFlash
|
7 |
+
import json
|
8 |
+
|
9 |
+
MODEL = GeminiFlash()
|
10 |
|
11 |
@mcp.tool()
|
12 |
+
async def generate_lesson_tool(topic: str, grade_level: int, duration_minutes: int) -> dict:
|
13 |
"""
|
14 |
+
Generate a lesson plan for the given topic, grade level, and duration, fully LLM-driven.
|
15 |
+
Use Gemini to generate a JSON object with objectives, activities, materials, assessment, differentiation, and homework.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
"""
|
17 |
+
prompt = (
|
18 |
+
f"Generate a detailed lesson plan as a JSON object for the topic '{topic}', grade {grade_level}, duration {duration_minutes} minutes. "
|
19 |
+
f"Include fields: objectives (list), activities (list), materials (list), assessment (dict), differentiation (dict), and homework (dict)."
|
20 |
+
)
|
21 |
+
llm_response = await MODEL.generate_text(prompt)
|
22 |
+
try:
|
23 |
+
data = json.loads(llm_response)
|
24 |
+
except Exception:
|
25 |
+
data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
26 |
+
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mcp_server/tools/ocr_tools.py
CHANGED
@@ -1,166 +1,142 @@
|
|
1 |
"""
|
2 |
-
OCR (Optical Character Recognition) tools for TutorX.
|
3 |
"""
|
4 |
-
import
|
5 |
-
import
|
6 |
-
import tempfile
|
7 |
-
from typing import Dict, Any, Optional, Tuple
|
8 |
-
# import fitz # PyMuPDFuv run
|
9 |
-
import pytesseract
|
10 |
-
from PIL import Image, ImageEnhance
|
11 |
-
import numpy as np
|
12 |
from mcp_server.mcp_instance import mcp
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
Args:
|
19 |
-
image: Input PIL Image
|
20 |
-
|
21 |
-
Returns:
|
22 |
-
Preprocessed PIL Image
|
23 |
-
"""
|
24 |
-
# Convert to grayscale
|
25 |
-
image = image.convert('L')
|
26 |
-
|
27 |
-
# Enhance contrast
|
28 |
-
enhancer = ImageEnhance.Contrast(image)
|
29 |
-
image = enhancer.enhance(2.0)
|
30 |
-
|
31 |
-
# Enhance sharpness
|
32 |
-
enhancer = ImageEnhance.Sharpness(image)
|
33 |
-
image = enhancer.enhance(2.0)
|
34 |
-
|
35 |
-
return image
|
36 |
|
37 |
-
def
|
38 |
"""
|
39 |
-
|
40 |
|
41 |
Args:
|
42 |
-
|
43 |
|
44 |
Returns:
|
45 |
-
|
46 |
"""
|
47 |
try:
|
48 |
-
#
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
#
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
raise RuntimeError(f"Error during OCR processing: {str(e)}")
|
56 |
-
|
57 |
-
def extract_text_from_pdf(pdf_data: bytes) -> Tuple[str, int]:
|
58 |
-
"""
|
59 |
-
Extract text from a PDF file.
|
60 |
-
|
61 |
-
Args:
|
62 |
-
pdf_data: PDF file content as bytes
|
63 |
|
64 |
-
Returns:
|
65 |
-
Tuple of (extracted_text, page_count)
|
66 |
-
"""
|
67 |
-
try:
|
68 |
-
# Open the PDF file
|
69 |
-
with fitz.open(stream=pdf_data, filetype="pdf") as doc:
|
70 |
-
page_count = len(doc)
|
71 |
-
extracted_text = []
|
72 |
-
|
73 |
-
# Extract text from each page
|
74 |
-
for page_num in range(page_count):
|
75 |
-
page = doc.load_page(page_num)
|
76 |
-
text = page.get_text()
|
77 |
-
|
78 |
-
# If no text is found, try OCR
|
79 |
-
if not text.strip():
|
80 |
-
pix = page.get_pixmap()
|
81 |
-
img_data = pix.tobytes("png")
|
82 |
-
img = Image.open(io.BytesIO(img_data))
|
83 |
-
text = extract_text_from_image(img)
|
84 |
-
|
85 |
-
extracted_text.append(text)
|
86 |
-
|
87 |
-
return "\n\n".join(extracted_text), page_count
|
88 |
except Exception as e:
|
89 |
-
raise RuntimeError(f"Error processing
|
90 |
|
91 |
@mcp.tool()
|
92 |
-
async def
|
93 |
"""
|
94 |
-
Extract text from
|
|
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
"pdf_data": "base64_encoded_pdf_data",
|
99 |
-
"filename": "document.pdf" # Optional
|
100 |
-
}
|
101 |
|
102 |
Returns:
|
103 |
-
Dictionary
|
104 |
"""
|
105 |
try:
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
116 |
|
117 |
-
#
|
118 |
-
|
|
|
119 |
|
120 |
-
#
|
121 |
result = {
|
122 |
"success": True,
|
123 |
-
"filename":
|
124 |
-
"
|
125 |
"extracted_text": extracted_text,
|
126 |
-
"character_count":
|
127 |
-
"word_count":
|
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 |
-
text = extract_text_from_image(image)
|
156 |
|
157 |
-
return {
|
158 |
-
"success": True,
|
159 |
-
"extracted_text": text,
|
160 |
-
"character_count": len(text),
|
161 |
-
"word_count": len(text.split()),
|
162 |
-
"image_size": image.size,
|
163 |
-
"image_mode": image.mode
|
164 |
-
}
|
165 |
except Exception as e:
|
166 |
-
return {
|
|
|
|
|
|
|
|
|
|
1 |
"""
|
2 |
+
OCR (Optical Character Recognition) tools for TutorX with Mistral OCR integration.
|
3 |
"""
|
4 |
+
import os
|
5 |
+
from typing import Dict, Any, Optional
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
from mcp_server.mcp_instance import mcp
|
7 |
+
from mcp_server.model.gemini_flash import GeminiFlash
|
8 |
+
from mistralai import Mistral
|
9 |
|
10 |
+
# Initialize models
|
11 |
+
MODEL = GeminiFlash()
|
12 |
+
client = Mistral(api_key="5oHGQTYDGD3ecQZSqdLsr5ZL4nOsfGYj")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
async def mistral_ocr_request(document_url: str) -> dict:
|
15 |
"""
|
16 |
+
Send OCR request to Mistral OCR service using document URL.
|
17 |
|
18 |
Args:
|
19 |
+
document_url: URL of the document to process
|
20 |
|
21 |
Returns:
|
22 |
+
OCR response from Mistral
|
23 |
"""
|
24 |
try:
|
25 |
+
# Process document with Mistral OCR
|
26 |
+
ocr_response = client.ocr.process(
|
27 |
+
model="mistral-ocr-latest",
|
28 |
+
document={
|
29 |
+
"type": "document_url",
|
30 |
+
"document_url": document_url
|
31 |
+
},
|
32 |
+
include_image_base64=True
|
33 |
+
)
|
34 |
|
35 |
+
# Convert the response to a dictionary
|
36 |
+
if hasattr(ocr_response, 'model_dump'):
|
37 |
+
return ocr_response.model_dump()
|
38 |
+
return ocr_response or {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
except Exception as e:
|
41 |
+
raise RuntimeError(f"Error processing document with Mistral OCR: {str(e)}")
|
42 |
|
43 |
@mcp.tool()
|
44 |
+
async def mistral_document_ocr(document_url: str) -> dict:
|
45 |
"""
|
46 |
+
Extract text from any document (PDF, image, etc.) using Mistral OCR service with document URL,
|
47 |
+
then use Gemini to summarize and extract key points as JSON.
|
48 |
|
49 |
+
Args:
|
50 |
+
document_url (str): URL of the document to process
|
|
|
|
|
|
|
51 |
|
52 |
Returns:
|
53 |
+
Dictionary with OCR results and AI analysis
|
54 |
"""
|
55 |
try:
|
56 |
+
if not document_url:
|
57 |
+
return {"error": "Document URL is required"}
|
58 |
+
|
59 |
+
# Extract filename from URL
|
60 |
+
filename = document_url.split('/')[-1] if '/' in document_url else "document"
|
61 |
+
|
62 |
+
# Call Mistral OCR API
|
63 |
+
ocr_response = await mistral_ocr_request(document_url)
|
64 |
+
|
65 |
+
# Extract text from Mistral response
|
66 |
+
extracted_text = ""
|
67 |
+
page_count = 0
|
68 |
|
69 |
+
if "pages" in ocr_response and isinstance(ocr_response["pages"], list):
|
70 |
+
# Extract text from each page's markdown field
|
71 |
+
extracted_text = "\n\n".join(
|
72 |
+
page.get("markdown", "")
|
73 |
+
for page in ocr_response["pages"]
|
74 |
+
if isinstance(page, dict) and "markdown" in page
|
75 |
+
)
|
76 |
+
page_count = len(ocr_response["pages"])
|
77 |
|
78 |
+
# Count words and characters
|
79 |
+
word_count = len(extracted_text.split())
|
80 |
+
char_count = len(extracted_text)
|
81 |
|
82 |
+
# Build result
|
83 |
result = {
|
84 |
"success": True,
|
85 |
+
"filename": filename,
|
86 |
+
"document_url": document_url,
|
87 |
"extracted_text": extracted_text,
|
88 |
+
"character_count": char_count,
|
89 |
+
"word_count": word_count,
|
90 |
+
"page_count": page_count,
|
91 |
+
"mistral_response": ocr_response,
|
92 |
+
"processing_service": "Mistral OCR",
|
93 |
+
"llm_analysis": {
|
94 |
+
"error": None,
|
95 |
+
"summary": "",
|
96 |
+
"key_points": [],
|
97 |
+
"document_type": "unknown"
|
98 |
+
}
|
99 |
}
|
100 |
|
101 |
+
# If we have text, try to analyze it with the LLM
|
102 |
+
if extracted_text.strip():
|
103 |
+
try:
|
104 |
+
# Use the LLM to analyze the extracted text
|
105 |
+
llm_prompt = f"""Analyze the following document and provide a brief summary, 3-5 key points, and the document type.
|
106 |
|
107 |
+
Document:
|
108 |
+
{extracted_text[:4000]} # Limit to first 4000 chars to avoid context window issues
|
109 |
+
"""
|
110 |
+
|
111 |
+
# Await the coroutine
|
112 |
+
llm_response = await MODEL.generate_text(llm_prompt)
|
113 |
+
|
114 |
+
# Parse the LLM response
|
115 |
+
if llm_response:
|
116 |
+
# Try to parse as JSON if the response is in JSON format
|
117 |
+
try:
|
118 |
+
import json
|
119 |
+
llm_data = json.loads(llm_response)
|
120 |
+
result["llm_analysis"].update({
|
121 |
+
"summary": llm_data.get("summary", ""),
|
122 |
+
"key_points": llm_data.get("key_points", []),
|
123 |
+
"document_type": llm_data.get("document_type", "document")
|
124 |
+
})
|
125 |
+
except (json.JSONDecodeError, AttributeError):
|
126 |
+
# If not JSON, use the raw response as summary
|
127 |
+
result["llm_analysis"].update({
|
128 |
+
"summary": str(llm_response),
|
129 |
+
"document_type": "document"
|
130 |
+
})
|
131 |
+
|
132 |
+
except Exception as e:
|
133 |
+
result["llm_analysis"]["error"] = f"LLM analysis error: {str(e)}"
|
134 |
|
135 |
+
return result
|
|
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
except Exception as e:
|
138 |
+
return {
|
139 |
+
"success": False,
|
140 |
+
"error": f"Error processing document with Mistral OCR: {str(e)}",
|
141 |
+
"document_url": document_url
|
142 |
+
}
|
mcp_server/tools/quiz_tools.py
CHANGED
@@ -15,48 +15,26 @@ PROMPT_TEMPLATE = (Path(__file__).parent.parent / "prompts" / "quiz_generation.t
|
|
15 |
MODEL = GeminiFlash()
|
16 |
|
17 |
@mcp.tool()
|
18 |
-
async def generate_quiz_tool(concept: str, difficulty: str = "medium") ->
|
19 |
"""
|
20 |
-
Generate a quiz based on a concept and difficulty using Gemini.
|
21 |
-
|
22 |
-
Args:
|
23 |
-
concept: The concept to generate a quiz about
|
24 |
-
difficulty: Difficulty level (easy, medium, hard)
|
25 |
-
|
26 |
-
Returns:
|
27 |
-
Dict containing the generated quiz in JSON format
|
28 |
"""
|
29 |
try:
|
30 |
-
# Validate inputs
|
31 |
if not concept or not isinstance(concept, str):
|
32 |
return {"error": "concept must be a non-empty string"}
|
33 |
-
|
34 |
valid_difficulties = ["easy", "medium", "hard"]
|
35 |
if difficulty.lower() not in valid_difficulties:
|
36 |
return {"error": f"difficulty must be one of {valid_difficulties}"}
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
concept=concept,
|
41 |
-
difficulty=difficulty.lower()
|
42 |
)
|
43 |
-
|
44 |
-
# Generate quiz using Gemini
|
45 |
-
response = await MODEL.generate_text(prompt, temperature=0.7)
|
46 |
-
|
47 |
-
# Try to parse the JSON response
|
48 |
try:
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
json_str = response
|
54 |
-
|
55 |
-
quiz_data = json.loads(json_str)
|
56 |
-
return quiz_data
|
57 |
-
|
58 |
-
except json.JSONDecodeError as e:
|
59 |
-
return {"error": f"Failed to parse quiz response: {str(e)}", "raw_response": response}
|
60 |
-
|
61 |
except Exception as e:
|
62 |
return {"error": f"Error generating quiz: {str(e)}"}
|
|
|
15 |
MODEL = GeminiFlash()
|
16 |
|
17 |
@mcp.tool()
|
18 |
+
async def generate_quiz_tool(concept: str, difficulty: str = "medium") -> dict:
|
19 |
"""
|
20 |
+
Generate a quiz based on a concept and difficulty using Gemini, fully LLM-driven.
|
21 |
+
The JSON should include a list of questions, each with options and the correct answer.
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
"""
|
23 |
try:
|
|
|
24 |
if not concept or not isinstance(concept, str):
|
25 |
return {"error": "concept must be a non-empty string"}
|
|
|
26 |
valid_difficulties = ["easy", "medium", "hard"]
|
27 |
if difficulty.lower() not in valid_difficulties:
|
28 |
return {"error": f"difficulty must be one of {valid_difficulties}"}
|
29 |
+
prompt = (
|
30 |
+
f"Generate a {difficulty} quiz on the concept '{concept}'. "
|
31 |
+
f"Return a JSON object with a 'questions' field: a list of questions, each with 'question', 'options' (list), and 'answer'."
|
|
|
|
|
32 |
)
|
33 |
+
llm_response = await MODEL.generate_text(prompt, temperature=0.7)
|
|
|
|
|
|
|
|
|
34 |
try:
|
35 |
+
quiz_data = json.loads(llm_response)
|
36 |
+
except Exception:
|
37 |
+
quiz_data = {"llm_raw": llm_response, "error": "Failed to parse LLM output as JSON"}
|
38 |
+
return quiz_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
except Exception as e:
|
40 |
return {"error": f"Error generating quiz: {str(e)}"}
|
tests/ocr_app.py
ADDED
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
Gradio app for document OCR processing with Mistral OCR.
|
3 |
+
|
4 |
+
Features:
|
5 |
+
- File upload to storage API
|
6 |
+
- Document processing using Mistral OCR
|
7 |
+
- Display of OCR results
|
8 |
+
"""
|
9 |
+
|
10 |
+
import os
|
11 |
+
import requests
|
12 |
+
import gradio as gr
|
13 |
+
import asyncio
|
14 |
+
import json
|
15 |
+
import tempfile
|
16 |
+
from typing import Dict, Any, Optional
|
17 |
+
from pathlib import Path
|
18 |
+
|
19 |
+
# Mistral AI
|
20 |
+
from mistralai import Mistral
|
21 |
+
|
22 |
+
# API Configuration
|
23 |
+
STORAGE_API_URL = "https://storage-bucket-api.vercel.app/upload"
|
24 |
+
MISTRAL_API_KEY = "5oHGQTYDGD3ecQZSqdLsr5ZL4nOsfGYj" # In production, use environment variables
|
25 |
+
|
26 |
+
# Initialize Mistral client
|
27 |
+
client = Mistral(api_key=MISTRAL_API_KEY)
|
28 |
+
|
29 |
+
class MistralOCRProcessor:
|
30 |
+
"""Handles document OCR processing using Mistral AI"""
|
31 |
+
|
32 |
+
def __init__(self, client: Mistral = None):
|
33 |
+
self.client = client or Mistral(api_key=MISTRAL_API_KEY)
|
34 |
+
|
35 |
+
async def process_document(self, document_path: str) -> Dict[str, Any]:
|
36 |
+
"""
|
37 |
+
Process a document using Mistral OCR
|
38 |
+
|
39 |
+
Args:
|
40 |
+
document_path: Local path to the document to process
|
41 |
+
|
42 |
+
Returns:
|
43 |
+
Dict containing OCR results or error information
|
44 |
+
"""
|
45 |
+
try:
|
46 |
+
# For local files, we need to upload to a temporary URL first
|
47 |
+
upload_result = await StorageManager().upload_file(document_path)
|
48 |
+
if not upload_result.get("success"):
|
49 |
+
return {
|
50 |
+
"success": False,
|
51 |
+
"result": None,
|
52 |
+
"error": f"Upload failed: {upload_result.get('error')}"
|
53 |
+
}
|
54 |
+
|
55 |
+
document_url = upload_result.get("storage_url")
|
56 |
+
if not document_url:
|
57 |
+
return {
|
58 |
+
"success": False,
|
59 |
+
"result": None,
|
60 |
+
"error": "No storage URL returned from upload"
|
61 |
+
}
|
62 |
+
|
63 |
+
# Process with Mistral OCR
|
64 |
+
ocr_response = self.client.ocr.process(
|
65 |
+
model="mistral-ocr-latest",
|
66 |
+
document={
|
67 |
+
"type": "document_url",
|
68 |
+
"document_url": document_url
|
69 |
+
},
|
70 |
+
include_image_base64=True
|
71 |
+
)
|
72 |
+
|
73 |
+
# Convert response to dict if it's a Pydantic model
|
74 |
+
if hasattr(ocr_response, 'model_dump'):
|
75 |
+
result = ocr_response.model_dump()
|
76 |
+
else:
|
77 |
+
result = ocr_response
|
78 |
+
|
79 |
+
return {
|
80 |
+
"success": True,
|
81 |
+
"result": result,
|
82 |
+
"document_url": document_url,
|
83 |
+
"error": None
|
84 |
+
}
|
85 |
+
|
86 |
+
except Exception as e:
|
87 |
+
return {
|
88 |
+
"success": False,
|
89 |
+
"result": None,
|
90 |
+
"error": f"OCR processing error: {str(e)}"
|
91 |
+
}
|
92 |
+
|
93 |
+
class StorageManager:
|
94 |
+
"""Handles file uploads to the storage service"""
|
95 |
+
|
96 |
+
def __init__(self, api_url: str = STORAGE_API_URL):
|
97 |
+
self.api_url = api_url
|
98 |
+
|
99 |
+
async def upload_file(self, file_path: str) -> Dict[str, Any]:
|
100 |
+
"""
|
101 |
+
Upload a file to the storage service
|
102 |
+
|
103 |
+
Args:
|
104 |
+
file_path: Path to the file to upload
|
105 |
+
|
106 |
+
Returns:
|
107 |
+
Dict containing upload result or error information
|
108 |
+
"""
|
109 |
+
try:
|
110 |
+
with open(file_path, 'rb') as f:
|
111 |
+
files = {'file': (os.path.basename(file_path), f)}
|
112 |
+
response = requests.post(self.api_url, files=files)
|
113 |
+
response.raise_for_status()
|
114 |
+
result = response.json()
|
115 |
+
|
116 |
+
if not result.get('success'):
|
117 |
+
raise Exception(result.get('message', 'Upload failed'))
|
118 |
+
|
119 |
+
return {
|
120 |
+
"success": True,
|
121 |
+
"storage_url": result.get('storage_url'),
|
122 |
+
"original_filename": result.get('original_filename'),
|
123 |
+
"file_size": result.get('file_size'),
|
124 |
+
"error": None
|
125 |
+
}
|
126 |
+
|
127 |
+
except Exception as e:
|
128 |
+
return {
|
129 |
+
"success": False,
|
130 |
+
"storage_url": None,
|
131 |
+
"original_filename": os.path.basename(file_path),
|
132 |
+
"file_size": os.path.getsize(file_path) if os.path.exists(file_path) else 0,
|
133 |
+
"error": f"Upload failed: {str(e)}"
|
134 |
+
}
|
135 |
+
|
136 |
+
# Initialize processors
|
137 |
+
ocr_processor = MistralOCRProcessor()
|
138 |
+
storage_manager = StorageManager()
|
139 |
+
|
140 |
+
async def process_document_ocr(file_path: str) -> Dict[str, Any]:
|
141 |
+
"""
|
142 |
+
Process a document through the complete OCR pipeline
|
143 |
+
|
144 |
+
Args:
|
145 |
+
file_path: Path to the document file
|
146 |
+
|
147 |
+
Returns:
|
148 |
+
Dict containing processing results
|
149 |
+
"""
|
150 |
+
# Process with Mistral OCR (handles upload internally)
|
151 |
+
result = await ocr_processor.process_document(file_path)
|
152 |
+
|
153 |
+
if not result.get("success"):
|
154 |
+
return {
|
155 |
+
"success": False,
|
156 |
+
"upload": {"success": False},
|
157 |
+
"ocr": None,
|
158 |
+
"error": result.get("error", "Unknown error")
|
159 |
+
}
|
160 |
+
|
161 |
+
# Get the original filename from the file path
|
162 |
+
original_filename = Path(file_path).name
|
163 |
+
file_size = os.path.getsize(file_path)
|
164 |
+
|
165 |
+
return {
|
166 |
+
"success": True,
|
167 |
+
"upload": {
|
168 |
+
"success": True,
|
169 |
+
"storage_url": result.get("document_url"),
|
170 |
+
"original_filename": original_filename,
|
171 |
+
"file_size": file_size
|
172 |
+
},
|
173 |
+
"ocr": result.get("result"),
|
174 |
+
"error": None,
|
175 |
+
"storage_url": result.get("document_url")
|
176 |
+
}
|
177 |
+
|
178 |
+
# Gradio Interface
|
179 |
+
def create_gradio_interface():
|
180 |
+
"""Create and return the Gradio interface"""
|
181 |
+
with gr.Blocks(title="Document OCR Processor", theme=gr.themes.Soft()) as demo:
|
182 |
+
gr.Markdown("# Document OCR Processor")
|
183 |
+
gr.Markdown("Upload a document (PDF, JPG, JPEG, PNG) to process with Mistral OCR")
|
184 |
+
|
185 |
+
with gr.Row():
|
186 |
+
with gr.Column(scale=2):
|
187 |
+
file_input = gr.File(label="Upload Document", type="filepath")
|
188 |
+
process_btn = gr.Button("Process Document", variant="primary")
|
189 |
+
|
190 |
+
with gr.Accordion("Debug Info", open=False):
|
191 |
+
status_text = gr.Textbox(label="Status", interactive=False)
|
192 |
+
|
193 |
+
with gr.Column(scale=3):
|
194 |
+
with gr.Tabs():
|
195 |
+
with gr.TabItem("OCR Results"):
|
196 |
+
ocr_output = gr.JSON(label="OCR Output")
|
197 |
+
with gr.TabItem("Extracted Text"):
|
198 |
+
text_output = gr.Textbox(label="Extracted Text", lines=20, max_lines=50)
|
199 |
+
with gr.TabItem("Upload Info"):
|
200 |
+
upload_info = gr.JSON(label="Upload Information")
|
201 |
+
|
202 |
+
def update_status(message):
|
203 |
+
return message
|
204 |
+
|
205 |
+
async def process_file(file_path):
|
206 |
+
try:
|
207 |
+
status = "Starting document processing..."
|
208 |
+
yield {status_text: update_status(status)}
|
209 |
+
|
210 |
+
# Process the document
|
211 |
+
result = await process_document_ocr(file_path)
|
212 |
+
|
213 |
+
if not result["success"]:
|
214 |
+
error_msg = result.get('error', 'Unknown error')
|
215 |
+
yield {
|
216 |
+
status_text: update_status(f"❌ {error_msg}"),
|
217 |
+
ocr_output: None,
|
218 |
+
text_output: "",
|
219 |
+
upload_info: None
|
220 |
+
}
|
221 |
+
return
|
222 |
+
|
223 |
+
# Extract text from OCR result
|
224 |
+
extracted_text = ""
|
225 |
+
ocr_data = result.get("ocr", {})
|
226 |
+
|
227 |
+
# Handle different OCR result formats
|
228 |
+
if isinstance(ocr_data, dict):
|
229 |
+
if "text" in ocr_data:
|
230 |
+
extracted_text = ocr_data["text"]
|
231 |
+
elif "pages" in ocr_data and isinstance(ocr_data["pages"], list):
|
232 |
+
extracted_text = "\n\n".join(
|
233 |
+
page.get("text", "")
|
234 |
+
for page in ocr_data["pages"]
|
235 |
+
if page and isinstance(page, dict) and "text" in page
|
236 |
+
)
|
237 |
+
|
238 |
+
# Prepare upload info
|
239 |
+
upload_info_data = {
|
240 |
+
"original_filename": result["upload"].get("original_filename"),
|
241 |
+
"file_size": result["upload"].get("file_size"),
|
242 |
+
"storage_url": result["upload"].get("storage_url"),
|
243 |
+
}
|
244 |
+
|
245 |
+
yield {
|
246 |
+
status_text: update_status("✅ Document processed successfully"),
|
247 |
+
ocr_output: ocr_data,
|
248 |
+
text_output: extracted_text,
|
249 |
+
upload_info: upload_info_data
|
250 |
+
}
|
251 |
+
|
252 |
+
except Exception as e:
|
253 |
+
import traceback
|
254 |
+
error_trace = traceback.format_exc()
|
255 |
+
error_msg = f"Unexpected error: {str(e)}"
|
256 |
+
yield {
|
257 |
+
status_text: update_status(f"❌ {error_msg}"),
|
258 |
+
ocr_output: None,
|
259 |
+
text_output: "",
|
260 |
+
upload_info: None
|
261 |
+
}
|
262 |
+
|
263 |
+
# Connect the process button to the processing function
|
264 |
+
process_btn.click(
|
265 |
+
fn=process_file,
|
266 |
+
inputs=file_input,
|
267 |
+
outputs=[status_text, ocr_output, text_output, upload_info]
|
268 |
+
)
|
269 |
+
|
270 |
+
# Auto-process when a file is uploaded
|
271 |
+
file_input.change(
|
272 |
+
fn=lambda x: "Ready to process. Click 'Process Document' to continue.",
|
273 |
+
inputs=file_input,
|
274 |
+
outputs=status_text
|
275 |
+
)
|
276 |
+
|
277 |
+
return demo.launch(server_name="0.0.0.0", server_port=7860)
|
278 |
+
|
279 |
+
if __name__ == "__main__":
|
280 |
+
# Create and launch the interface
|
281 |
+
create_gradio_interface()
|
tests/test_tools_integration.py
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pytest
|
2 |
+
import asyncio
|
3 |
+
import base64
|
4 |
+
import os
|
5 |
+
from mcp import ClientSession
|
6 |
+
from mcp.client.sse import sse_client
|
7 |
+
|
8 |
+
SERVER_URL = "http://localhost:8000/sse" # Adjust if needed
|
9 |
+
|
10 |
+
@pytest.mark.asyncio
|
11 |
+
async def test_get_concept_graph_tool():
|
12 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
13 |
+
async with ClientSession(sse, write) as session:
|
14 |
+
await session.initialize()
|
15 |
+
result = await session.call_tool("get_concept_graph_tool", {"concept_id": "python"})
|
16 |
+
assert result and "error" not in result
|
17 |
+
|
18 |
+
@pytest.mark.asyncio
|
19 |
+
async def test_generate_quiz_tool():
|
20 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
21 |
+
async with ClientSession(sse, write) as session:
|
22 |
+
await session.initialize()
|
23 |
+
result = await session.call_tool("generate_quiz_tool", {"concept": "python", "difficulty": "easy"})
|
24 |
+
assert result and "error" not in result
|
25 |
+
|
26 |
+
@pytest.mark.asyncio
|
27 |
+
async def test_generate_lesson_tool():
|
28 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
29 |
+
async with ClientSession(sse, write) as session:
|
30 |
+
await session.initialize()
|
31 |
+
result = await session.call_tool("generate_lesson_tool", {"topic": "Algebra", "grade_level": 8, "duration_minutes": 45})
|
32 |
+
assert result and "error" not in result
|
33 |
+
|
34 |
+
@pytest.mark.asyncio
|
35 |
+
async def test_get_learning_path():
|
36 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
37 |
+
async with ClientSession(sse, write) as session:
|
38 |
+
await session.initialize()
|
39 |
+
result = await session.call_tool("get_learning_path", {"student_id": "student_1", "concept_ids": ["python", "oop"], "student_level": "beginner"})
|
40 |
+
assert result and "error" not in result
|
41 |
+
|
42 |
+
@pytest.mark.asyncio
|
43 |
+
async def test_text_interaction():
|
44 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
45 |
+
async with ClientSession(sse, write) as session:
|
46 |
+
await session.initialize()
|
47 |
+
result = await session.call_tool("text_interaction", {"query": "What is a function in Python?", "student_id": "student_1"})
|
48 |
+
assert result and "error" not in result
|
49 |
+
|
50 |
+
@pytest.mark.asyncio
|
51 |
+
async def test_check_submission_originality():
|
52 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
53 |
+
async with ClientSession(sse, write) as session:
|
54 |
+
await session.initialize()
|
55 |
+
result = await session.call_tool("check_submission_originality", {"submission": "Python is a programming language.", "reference_sources": ["Python is a programming language.", "Java is another language."]})
|
56 |
+
assert result and "error" not in result
|
57 |
+
|
58 |
+
@pytest.mark.asyncio
|
59 |
+
async def test_pdf_ocr(tmp_path):
|
60 |
+
# Create a dummy PDF file
|
61 |
+
pdf_path = tmp_path / "test.pdf"
|
62 |
+
with open(pdf_path, "wb") as f:
|
63 |
+
f.write(b"%PDF-1.4 test pdf content")
|
64 |
+
with open(pdf_path, "rb") as f:
|
65 |
+
pdf_data = f.read()
|
66 |
+
pdf_b64 = base64.b64encode(pdf_data).decode("utf-8")
|
67 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
68 |
+
async with ClientSession(sse, write) as session:
|
69 |
+
await session.initialize()
|
70 |
+
result = await session.call_tool("pdf_ocr", {"pdf_data": pdf_b64, "filename": "test.pdf"})
|
71 |
+
assert result and ("error" not in result or "Error processing PDF" in result.get("error", ""))
|
72 |
+
|
73 |
+
@pytest.mark.asyncio
|
74 |
+
async def test_image_to_text():
|
75 |
+
# Create a dummy image (1x1 pixel PNG)
|
76 |
+
import io
|
77 |
+
from PIL import Image
|
78 |
+
img = Image.new("RGB", (1, 1), color="white")
|
79 |
+
buf = io.BytesIO()
|
80 |
+
img.save(buf, format="PNG")
|
81 |
+
img_b64 = base64.b64encode(buf.getvalue()).decode("utf-8")
|
82 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
83 |
+
async with ClientSession(sse, write) as session:
|
84 |
+
await session.initialize()
|
85 |
+
result = await session.call_tool("image_to_text", {"image_data": img_b64})
|
86 |
+
assert result and "error" not in result
|
87 |
+
|
88 |
+
@pytest.mark.asyncio
|
89 |
+
async def test_get_concept_tool():
|
90 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
91 |
+
async with ClientSession(sse, write) as session:
|
92 |
+
await session.initialize()
|
93 |
+
result = await session.call_tool("get_concept_tool", {"concept_id": "python"})
|
94 |
+
assert result and "error" not in result
|
95 |
+
|
96 |
+
@pytest.mark.asyncio
|
97 |
+
async def test_assess_skill_tool():
|
98 |
+
async with sse_client(SERVER_URL) as (sse, write):
|
99 |
+
async with ClientSession(sse, write) as session:
|
100 |
+
await session.initialize()
|
101 |
+
result = await session.call_tool("assess_skill_tool", {"student_id": "student_1", "concept_id": "python"})
|
102 |
+
assert result and "error" not in result
|
103 |
+
|
104 |
+
if __name__ == "__main__":
|
105 |
+
import sys
|
106 |
+
import pytest
|
107 |
+
sys.exit(pytest.main([__file__]))
|
tests/test_upload_ocr.py
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
Test script for file upload and OCR functionality.
|
3 |
+
|
4 |
+
This script tests the file upload to the storage API and verifies the OCR functionality with the returned storage URL.
|
5 |
+
"""
|
6 |
+
|
7 |
+
import os
|
8 |
+
import requests
|
9 |
+
import asyncio
|
10 |
+
import argparse
|
11 |
+
from pathlib import Path
|
12 |
+
|
13 |
+
# Configuration
|
14 |
+
STORAGE_API_URL = "https://storage-bucket-api.vercel.app/upload"
|
15 |
+
|
16 |
+
async def upload_file_to_storage(file_path):
|
17 |
+
"""Helper function to upload file to storage API"""
|
18 |
+
try:
|
19 |
+
with open(file_path, 'rb') as f:
|
20 |
+
files = {'file': (os.path.basename(file_path), f)}
|
21 |
+
print(f"Uploading {file_path} to storage...")
|
22 |
+
response = requests.post(STORAGE_API_URL, files=files)
|
23 |
+
response.raise_for_status()
|
24 |
+
result = response.json()
|
25 |
+
print("\nUpload successful! Response:")
|
26 |
+
print(f"- Success: {result.get('success')}")
|
27 |
+
print(f"- Message: {result.get('message')}")
|
28 |
+
print(f"- Original filename: {result.get('original_filename')}")
|
29 |
+
print(f"- Uploaded filename: {result.get('uploaded_filename')}")
|
30 |
+
print(f"- File size: {result.get('file_size')} bytes")
|
31 |
+
print(f"- Content type: {result.get('content_type')}")
|
32 |
+
print(f"- Storage URL: {result.get('storage_url')}")
|
33 |
+
return result
|
34 |
+
except Exception as e:
|
35 |
+
print(f"Error uploading file: {str(e)}")
|
36 |
+
if hasattr(e, 'response') and e.response is not None:
|
37 |
+
print(f"Server response: {e.response.text}")
|
38 |
+
return {"error": str(e), "success": False}
|
39 |
+
|
40 |
+
async def test_ocr_with_storage_url(storage_url):
|
41 |
+
"""Test OCR functionality with a storage URL"""
|
42 |
+
print(f"\nTesting OCR with URL: {storage_url}")
|
43 |
+
# This is a placeholder for the actual OCR test
|
44 |
+
# You would typically call your OCR service here
|
45 |
+
print("OCR test would process the document at:", storage_url)
|
46 |
+
print("OCR test completed (mock implementation)")
|
47 |
+
return {"success": True, "message": "OCR test completed (mock implementation)"}
|
48 |
+
|
49 |
+
async def main():
|
50 |
+
parser = argparse.ArgumentParser(description='Test file upload and OCR functionality')
|
51 |
+
parser.add_argument('file_path', type=str, help='Path to the file to upload and test')
|
52 |
+
parser.add_argument('--test-ocr', action='store_true',
|
53 |
+
help='Test OCR functionality with the uploaded file')
|
54 |
+
|
55 |
+
args = parser.parse_args()
|
56 |
+
|
57 |
+
# Verify file exists
|
58 |
+
if not os.path.exists(args.file_path):
|
59 |
+
print(f"Error: File not found: {args.file_path}")
|
60 |
+
return
|
61 |
+
|
62 |
+
# Upload the file
|
63 |
+
upload_result = await upload_file_to_storage(args.file_path)
|
64 |
+
|
65 |
+
if not upload_result.get('success'):
|
66 |
+
print("\nUpload failed. Cannot proceed with OCR test.")
|
67 |
+
return
|
68 |
+
|
69 |
+
storage_url = upload_result.get('storage_url')
|
70 |
+
if not storage_url:
|
71 |
+
print("\nNo storage URL in upload response. Cannot test OCR functionality.")
|
72 |
+
return
|
73 |
+
|
74 |
+
# Test OCR if requested
|
75 |
+
if args.test_ocr:
|
76 |
+
await test_ocr_with_storage_url(storage_url)
|
77 |
+
|
78 |
+
if __name__ == "__main__":
|
79 |
+
asyncio.run(main())
|