获取当前打开的学习集
const ctx = await mn.api('/context');
if (!ctx.available) mn.log('取不到上下文:' + ctx.reason);{
"available": true,
"studySet": {
"isDeck": false
},
"currentPage": {
"bookmd5": "8daef026f17a04db9b325c86366419936de1ef8b454218998990a3cef6f467a7",
"page": 6,
"mappingAvailable": true
},
"focusedNote": "",
"capturedAt": "2026-10-06T15:51:30Z",
"template": {
"id": "reading-vocabulary",
"name": "外刊生词",
"builtIn": false,
"immersive": true
}
}能力与状态
获取操作上下文
返回当前打开的学习集与文档、当前页、选中的卡与焦点卡。与 GET /ui-state 的分工:
该接口返回整理过的语义,/ui-state 返回界面自己的键值。
无法获取信息时仍返回 200,available 为 false,原因见 reason。
GET
/
context
获取当前打开的学习集
const ctx = await mn.api('/context');
if (!ctx.available) mn.log('取不到上下文:' + ctx.reason);{
"available": true,
"studySet": {
"isDeck": false
},
"currentPage": {
"bookmd5": "8daef026f17a04db9b325c86366419936de1ef8b454218998990a3cef6f467a7",
"page": 6,
"mappingAvailable": true
},
"focusedNote": "",
"capturedAt": "2026-10-06T15:51:30Z",
"template": {
"id": "reading-vocabulary",
"name": "外刊生词",
"builtIn": false,
"immersive": true
}
}响应
200 - application/json
当前上下文。
Show child attributes
Show child attributes
实测为空数组,条目结构没有依据。
Show child attributes
Show child attributes
Show child attributes
Show child attributes
实测为 null。什么情况下返回非空,尚无依据。
Show child attributes
Show child attributes
⚠️获取不到时的原因。
可用选项:
nothing_open, app_not_responding, window_unavailable, read_failed