unitoolkit 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ladok_vakt/__init__.py +7 -0
- ladok_vakt/__main__.py +51 -0
- ladok_vakt/core.py +553 -0
- ladok_vakt/login.py +232 -0
- tools.json +623 -0
- unitoolkit/__init__.py +1 -0
- unitoolkit/__main__.py +63 -0
- unitoolkit/agent.py +270 -0
- unitoolkit/browser.py +147 -0
- unitoolkit/canvas.py +189 -0
- unitoolkit/chainproxy.py +113 -0
- unitoolkit/citation.py +165 -0
- unitoolkit/databases.py +497 -0
- unitoolkit/docs.py +394 -0
- unitoolkit/fulltext.py +260 -0
- unitoolkit/koha.py +729 -0
- unitoolkit/mcp.py +85 -0
- unitoolkit/programme.py +147 -0
- unitoolkit/search.py +507 -0
- unitoolkit/serve.py +153 -0
- unitoolkit/sharepoint.py +86 -0
- unitoolkit/surface.py +86 -0
- unitoolkit/timeedit.py +209 -0
- unitoolkit/tools.py +555 -0
- unitoolkit-0.7.0.dist-info/METADATA +177 -0
- unitoolkit-0.7.0.dist-info/RECORD +30 -0
- unitoolkit-0.7.0.dist-info/WHEEL +5 -0
- unitoolkit-0.7.0.dist-info/entry_points.txt +4 -0
- unitoolkit-0.7.0.dist-info/licenses/LICENSE +21 -0
- unitoolkit-0.7.0.dist-info/top_level.txt +2 -0
tools.json
ADDED
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "today",
|
|
4
|
+
"description": "START HERE for 'what do I need to do?'. Everything due in the next N days (default 14) from every system at once: Canvas deadlines not yet submitted, Ladok registration windows open now or opening soon, this week's timetable, and (library=true) library loans due back. Each section reports its own error, so one dead session never hides the rest.",
|
|
5
|
+
"inputSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"days": {
|
|
9
|
+
"type": "integer"
|
|
10
|
+
},
|
|
11
|
+
"library": {
|
|
12
|
+
"type": "boolean"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": [],
|
|
16
|
+
"additionalProperties": false
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "doctor",
|
|
21
|
+
"description": "Health check of every session the toolkit depends on (Canvas token and its expiry date, agent browser, Ladok, database proxy, library, timetable link). Each row has the fix, which is always a human action. Run it when another tool fails. only='canvas,ladok' limits the checks.",
|
|
22
|
+
"inputSchema": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"only": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": [],
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "schedule",
|
|
35
|
+
"description": "Timetable for any course code (1SPRY2), student group (H26SK) or room, for any period, from TimeEdit without a login. kind=code|group|room|subject. start/end as YYYY-MM-DD or TimeEdit relative form (0.d = today, 4.w = four weeks). Course NAMES are not indexed: search the code or the group.",
|
|
36
|
+
"inputSchema": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"query": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"kind": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
},
|
|
45
|
+
"start": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"end": {
|
|
49
|
+
"type": "string"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": [
|
|
53
|
+
"query"
|
|
54
|
+
],
|
|
55
|
+
"additionalProperties": false
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "free_rooms",
|
|
60
|
+
"description": "Which student-bookable rooms are free on a date (default today), as gaps between bookings within the booking rules (Mon-Fri 08-20, up to 3 days ahead, max 4 h). Read-only: booking itself is done by the student in TimeEdit.",
|
|
61
|
+
"inputSchema": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": {
|
|
64
|
+
"date": {
|
|
65
|
+
"type": "string"
|
|
66
|
+
},
|
|
67
|
+
"min_minutes": {
|
|
68
|
+
"type": "integer"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": [],
|
|
72
|
+
"additionalProperties": false
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "library",
|
|
77
|
+
"description": "The school library (Koha). With query: catalogue search with availability per copy. Without: the student's own loans with due dates and days left, holds and fines.",
|
|
78
|
+
"inputSchema": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"properties": {
|
|
81
|
+
"query": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"limit": {
|
|
85
|
+
"type": "integer"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"required": [],
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "ladok_windows",
|
|
94
|
+
"description": "Ladok registration windows (kursregistrering + tentamensanmälan): what opens when, what closes within N days, with course period. Needs the agent Chrome logged in to Ladok (CDP :9233); read-only, never registers anything. Subrepo: ladok_vakt/.",
|
|
95
|
+
"inputSchema": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"properties": {
|
|
98
|
+
"close_days": {
|
|
99
|
+
"type": "integer"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": [],
|
|
103
|
+
"additionalProperties": false
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "courses",
|
|
108
|
+
"description": "List the student's Canvas courses: id, code, name, term.",
|
|
109
|
+
"inputSchema": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {},
|
|
112
|
+
"required": [],
|
|
113
|
+
"additionalProperties": false
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "upcoming",
|
|
118
|
+
"description": "Everything due from today across all Canvas courses: title, course, due (UTC), submitted. Start here for 'what is due?'.",
|
|
119
|
+
"inputSchema": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"properties": {},
|
|
122
|
+
"required": [],
|
|
123
|
+
"additionalProperties": false
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "mirror",
|
|
128
|
+
"description": "Download a whole Canvas course (modules, pages, assignments with rubrics, announcements, discussions, files) to disk. course='all' mirrors every course.",
|
|
129
|
+
"inputSchema": {
|
|
130
|
+
"type": "object",
|
|
131
|
+
"properties": {
|
|
132
|
+
"course": {
|
|
133
|
+
"type": "string"
|
|
134
|
+
},
|
|
135
|
+
"out": {
|
|
136
|
+
"type": "string"
|
|
137
|
+
},
|
|
138
|
+
"files": {
|
|
139
|
+
"type": "boolean"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"required": [
|
|
143
|
+
"course"
|
|
144
|
+
],
|
|
145
|
+
"additionalProperties": false
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "canvas_get",
|
|
150
|
+
"description": "Raw Canvas REST GET with pagination, e.g. path='courses/123/assignments'. params is a JSON object of query parameters.",
|
|
151
|
+
"inputSchema": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"properties": {
|
|
154
|
+
"path": {
|
|
155
|
+
"type": "string"
|
|
156
|
+
},
|
|
157
|
+
"params": {
|
|
158
|
+
"type": "object"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"required": [
|
|
162
|
+
"path"
|
|
163
|
+
],
|
|
164
|
+
"additionalProperties": false
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "assignment",
|
|
169
|
+
"description": "One Canvas assignment with description and rubric as plain text.",
|
|
170
|
+
"inputSchema": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"course": {
|
|
174
|
+
"type": "integer"
|
|
175
|
+
},
|
|
176
|
+
"assignment": {
|
|
177
|
+
"type": "integer"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"required": [
|
|
181
|
+
"course",
|
|
182
|
+
"assignment"
|
|
183
|
+
],
|
|
184
|
+
"additionalProperties": false
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "login_check",
|
|
189
|
+
"description": "Which SSO sites (Canvas, SharePoint, Ladok) the agent browser is logged in to.",
|
|
190
|
+
"inputSchema": {
|
|
191
|
+
"type": "object",
|
|
192
|
+
"properties": {},
|
|
193
|
+
"required": [],
|
|
194
|
+
"additionalProperties": false
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "page",
|
|
199
|
+
"description": "Rendered text of any page, read through the student's logged-in browser (SharePoint, Ladok, Inspera, intranet).",
|
|
200
|
+
"inputSchema": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"properties": {
|
|
203
|
+
"url": {
|
|
204
|
+
"type": "string"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"required": [
|
|
208
|
+
"url"
|
|
209
|
+
],
|
|
210
|
+
"additionalProperties": false
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "fetch",
|
|
215
|
+
"description": "JSON/text fetch executed inside `origin` so the site's own cookies apply. Use for internal APIs (Ladok student API, SharePoint REST).",
|
|
216
|
+
"inputSchema": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"properties": {
|
|
219
|
+
"url": {
|
|
220
|
+
"type": "string"
|
|
221
|
+
},
|
|
222
|
+
"origin": {
|
|
223
|
+
"type": "string"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"required": [
|
|
227
|
+
"url",
|
|
228
|
+
"origin"
|
|
229
|
+
],
|
|
230
|
+
"additionalProperties": false
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"name": "sharepoint_download",
|
|
235
|
+
"description": "Download a SharePoint share link (/:b:/ or /:u:/ style) to a local file; returns path, size, type.",
|
|
236
|
+
"inputSchema": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"properties": {
|
|
239
|
+
"share_url": {
|
|
240
|
+
"type": "string"
|
|
241
|
+
},
|
|
242
|
+
"out": {
|
|
243
|
+
"type": "string"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"required": [
|
|
247
|
+
"share_url"
|
|
248
|
+
],
|
|
249
|
+
"additionalProperties": false
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "search",
|
|
254
|
+
"description": "Full-text search inside one course: pages, assignments with rubrics, modules, discussions, files. Operators: \"phrase\", -exclude, +required, OR, type:sida|uppgift|fil|modul|diskussion, filetype:pdf, intitle:word, before:YYYY-MM-DD, after:YYYY-MM-DD, plus regex/fuzzy toggles. source='mirror' searches a local mirror (fast, may be stale), 'api' fetches live from Canvas, 'auto' prefers the mirror. include_docs=true also searches the document text built by the docs tool.",
|
|
255
|
+
"inputSchema": {
|
|
256
|
+
"type": "object",
|
|
257
|
+
"properties": {
|
|
258
|
+
"course": {
|
|
259
|
+
"type": "string"
|
|
260
|
+
},
|
|
261
|
+
"query": {
|
|
262
|
+
"type": "string"
|
|
263
|
+
},
|
|
264
|
+
"source": {
|
|
265
|
+
"type": "string"
|
|
266
|
+
},
|
|
267
|
+
"regex": {
|
|
268
|
+
"type": "boolean"
|
|
269
|
+
},
|
|
270
|
+
"fuzzy": {
|
|
271
|
+
"type": "boolean"
|
|
272
|
+
},
|
|
273
|
+
"whole_word": {
|
|
274
|
+
"type": "boolean"
|
|
275
|
+
},
|
|
276
|
+
"case_sensitive": {
|
|
277
|
+
"type": "boolean"
|
|
278
|
+
},
|
|
279
|
+
"include_docs": {
|
|
280
|
+
"type": "boolean"
|
|
281
|
+
},
|
|
282
|
+
"limit": {
|
|
283
|
+
"type": "integer"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"required": [
|
|
287
|
+
"course",
|
|
288
|
+
"query"
|
|
289
|
+
],
|
|
290
|
+
"additionalProperties": false
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"name": "docs",
|
|
295
|
+
"description": "Download a course's files once, extract their text (pdf, docx, pptx, xlsx, html, images) and cache it keyed by file id + updated_at. Bytes are discarded, text is kept. ocr=true adds tesseract for documents with no usable text layer; it is slow, so it is not part of a normal index run.",
|
|
296
|
+
"inputSchema": {
|
|
297
|
+
"type": "object",
|
|
298
|
+
"properties": {
|
|
299
|
+
"course": {
|
|
300
|
+
"type": "string"
|
|
301
|
+
},
|
|
302
|
+
"ocr": {
|
|
303
|
+
"type": "boolean"
|
|
304
|
+
},
|
|
305
|
+
"force": {
|
|
306
|
+
"type": "boolean"
|
|
307
|
+
},
|
|
308
|
+
"max_files": {
|
|
309
|
+
"type": "integer"
|
|
310
|
+
},
|
|
311
|
+
"ocr_max_pages": {
|
|
312
|
+
"type": "integer"
|
|
313
|
+
},
|
|
314
|
+
"only_contains": {
|
|
315
|
+
"type": "string"
|
|
316
|
+
},
|
|
317
|
+
"links": {
|
|
318
|
+
"type": "boolean"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"required": [
|
|
322
|
+
"course"
|
|
323
|
+
],
|
|
324
|
+
"additionalProperties": false
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"name": "surface",
|
|
329
|
+
"description": "Probe which Canvas endpoints a student session can reach, before building anything on assumptions. Returns per-endpoint status, item count and payload size, plus a summary of what is blocked (pages index, quizzes and rubrics are commonly off).",
|
|
330
|
+
"inputSchema": {
|
|
331
|
+
"type": "object",
|
|
332
|
+
"properties": {
|
|
333
|
+
"course": {
|
|
334
|
+
"type": "string"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"required": [
|
|
338
|
+
"course"
|
|
339
|
+
],
|
|
340
|
+
"additionalProperties": false
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"name": "programme",
|
|
345
|
+
"description": "Map the whole SHH nursing programme: every course with its kursplan and kurslitteraturlista downloaded and verified by the course code inside each file.",
|
|
346
|
+
"inputSchema": {
|
|
347
|
+
"type": "object",
|
|
348
|
+
"properties": {
|
|
349
|
+
"out": {
|
|
350
|
+
"type": "string"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"required": [],
|
|
354
|
+
"additionalProperties": false
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"name": "timeedit",
|
|
359
|
+
"description": "Bookings from a TimeEdit schedule link (the .html URL the student copies from TimeEdit). Returns date, start, end and the booking columns. Note: a link covers only the period it was created for.",
|
|
360
|
+
"inputSchema": {
|
|
361
|
+
"type": "object",
|
|
362
|
+
"properties": {
|
|
363
|
+
"url": {
|
|
364
|
+
"type": "string"
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
"required": [
|
|
368
|
+
"url"
|
|
369
|
+
],
|
|
370
|
+
"additionalProperties": false
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"name": "koha_search",
|
|
375
|
+
"description": "Search the SHH library catalogue (Koha, biblioteket.shh.se) for course books and literature: title, biblionumber and availability per hit. Read-only. Goes through the proxied agent browser because the library's Cloudflare refuses plain HTTP clients.",
|
|
376
|
+
"inputSchema": {
|
|
377
|
+
"type": "object",
|
|
378
|
+
"properties": {
|
|
379
|
+
"q": {
|
|
380
|
+
"type": "string"
|
|
381
|
+
},
|
|
382
|
+
"limit": {
|
|
383
|
+
"type": "integer"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"required": [
|
|
387
|
+
"q"
|
|
388
|
+
],
|
|
389
|
+
"additionalProperties": false
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "koha_item",
|
|
394
|
+
"description": "One catalogue record by biblionumber: item table (placering, status, item type) and the record summary (publisher, edition, language). Read-only.",
|
|
395
|
+
"inputSchema": {
|
|
396
|
+
"type": "object",
|
|
397
|
+
"properties": {
|
|
398
|
+
"biblionumber": {
|
|
399
|
+
"type": "string"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"required": [
|
|
403
|
+
"biblionumber"
|
|
404
|
+
],
|
|
405
|
+
"additionalProperties": false
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "koha_loans",
|
|
410
|
+
"description": "Your own Koha account: loans with due dates and reservations with queue position. Needs ~/.secrets/KOHA_USER and ~/.secrets/KOHA_PIN (you create them; never printed). Read-only: no renewal, no reservation changes.",
|
|
411
|
+
"inputSchema": {
|
|
412
|
+
"type": "object",
|
|
413
|
+
"properties": {},
|
|
414
|
+
"required": [],
|
|
415
|
+
"additionalProperties": false
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"name": "koha_open_login",
|
|
420
|
+
"description": "Open the library account page in the proxied Chrome window and report whether the session is signed in. For the one-time manual sign-in; after that koha_loans reads the account from the session cookie.",
|
|
421
|
+
"inputSchema": {
|
|
422
|
+
"type": "object",
|
|
423
|
+
"properties": {},
|
|
424
|
+
"required": [],
|
|
425
|
+
"additionalProperties": false
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"name": "koha_wait_login",
|
|
430
|
+
"description": "Wait until the library account page shows a signed-in session, for the one-time manual sign-in in the proxied Chrome window. After that koha_loans needs no credentials.",
|
|
431
|
+
"inputSchema": {
|
|
432
|
+
"type": "object",
|
|
433
|
+
"properties": {
|
|
434
|
+
"timeout": {
|
|
435
|
+
"type": "integer"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
"required": [],
|
|
439
|
+
"additionalProperties": false
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"name": "koha_status",
|
|
444
|
+
"description": "Diagnostics for the Koha path: whether the proxied browser and the local chain proxy are up, and whether library credentials are on file.",
|
|
445
|
+
"inputSchema": {
|
|
446
|
+
"type": "object",
|
|
447
|
+
"properties": {},
|
|
448
|
+
"required": [],
|
|
449
|
+
"additionalProperties": false
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"name": "db_list",
|
|
454
|
+
"description": "List the subscription databases Sophiahemmet gives access to (CINAHL, PsycInfo, Cochrane, Web of Science, JCR, Sage Research Methods, NE, PubMed) and whether each one can be searched from here.",
|
|
455
|
+
"inputSchema": {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"properties": {},
|
|
458
|
+
"required": [],
|
|
459
|
+
"additionalProperties": false
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "db_status",
|
|
464
|
+
"description": "Check whether the school sign-in still works for a database (default cinahl). authenticated=false means the Entra session expired and someone has to sign in once in the school browser.",
|
|
465
|
+
"inputSchema": {
|
|
466
|
+
"type": "object",
|
|
467
|
+
"properties": {
|
|
468
|
+
"database": {
|
|
469
|
+
"type": "string"
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
"required": [],
|
|
473
|
+
"additionalProperties": false
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"name": "db_search",
|
|
478
|
+
"description": "Search a subscription database (cinahl, psycinfo) and return citations: title, authors, journal, year, volume, issue, pages, subjects, peer-reviewed, full-text, record URL. A bare multi-word query is joined with AND; quotes keep a phrase.",
|
|
479
|
+
"inputSchema": {
|
|
480
|
+
"type": "object",
|
|
481
|
+
"properties": {
|
|
482
|
+
"database": {
|
|
483
|
+
"type": "string"
|
|
484
|
+
},
|
|
485
|
+
"query": {
|
|
486
|
+
"type": "string"
|
|
487
|
+
},
|
|
488
|
+
"limit": {
|
|
489
|
+
"type": "integer"
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
"required": [],
|
|
493
|
+
"additionalProperties": false
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"name": "db_detail",
|
|
498
|
+
"description": "Open one database record and return its abstract, DOI, authors and source line. Pass the record URL from db_search.",
|
|
499
|
+
"inputSchema": {
|
|
500
|
+
"type": "object",
|
|
501
|
+
"properties": {
|
|
502
|
+
"url": {
|
|
503
|
+
"type": "string"
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
"required": [],
|
|
507
|
+
"additionalProperties": false
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"name": "db_open",
|
|
512
|
+
"description": "Open one database in the school browser and report where it landed. For the databases that have no structured search here (Cochrane, Web of Science, JCR, Sage, NE) and for signing in when the session has expired.",
|
|
513
|
+
"inputSchema": {
|
|
514
|
+
"type": "object",
|
|
515
|
+
"properties": {
|
|
516
|
+
"database": {
|
|
517
|
+
"type": "string"
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
"required": [],
|
|
521
|
+
"additionalProperties": false
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"name": "db_fulltext",
|
|
526
|
+
"description": "Full text of one article, by DOI, through the school's subscription (EZproxy). Saves the PDF under ~/.local/share/unitoolkit/fulltext and returns path, pages and the extracted text. Says why when there is no route (publisher outside the proxy: order it via fjärrlån; or an open-access copy exists). Capped at 20 downloads an hour: the licences allow reading for study, not bulk downloading.",
|
|
527
|
+
"inputSchema": {
|
|
528
|
+
"type": "object",
|
|
529
|
+
"properties": {
|
|
530
|
+
"doi": {
|
|
531
|
+
"type": "string"
|
|
532
|
+
},
|
|
533
|
+
"text": {
|
|
534
|
+
"type": "boolean"
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
"required": [],
|
|
538
|
+
"additionalProperties": false
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"name": "find_sources",
|
|
543
|
+
"description": "THE citation tool: one query across several databases (default cinahl, pubmed, cochrane; also psycinfo, wos), deduplicated by DOI, each hit with an APA 7 reference built from the publisher's own DOI metadata. Use this for 'find me sources on X'.",
|
|
544
|
+
"inputSchema": {
|
|
545
|
+
"type": "object",
|
|
546
|
+
"properties": {
|
|
547
|
+
"query": {
|
|
548
|
+
"type": "string"
|
|
549
|
+
},
|
|
550
|
+
"databases": {
|
|
551
|
+
"type": "array",
|
|
552
|
+
"items": {
|
|
553
|
+
"type": "string"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
"limit": {
|
|
557
|
+
"type": "integer"
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
"required": [
|
|
561
|
+
"query"
|
|
562
|
+
],
|
|
563
|
+
"additionalProperties": false
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"name": "apa",
|
|
568
|
+
"description": "APA 7 reference for a DOI, from the DOI registry (not from scraped pages). lang='sv' for svensk APA wording.",
|
|
569
|
+
"inputSchema": {
|
|
570
|
+
"type": "object",
|
|
571
|
+
"properties": {
|
|
572
|
+
"doi": {
|
|
573
|
+
"type": "string"
|
|
574
|
+
},
|
|
575
|
+
"lang": {
|
|
576
|
+
"type": "string"
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
"required": [
|
|
580
|
+
"doi"
|
|
581
|
+
],
|
|
582
|
+
"additionalProperties": false
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"name": "pubmed",
|
|
587
|
+
"description": "Search PubMed. Returns PMID, title, journal, year, authors, DOI.",
|
|
588
|
+
"inputSchema": {
|
|
589
|
+
"type": "object",
|
|
590
|
+
"properties": {
|
|
591
|
+
"query": {
|
|
592
|
+
"type": "string"
|
|
593
|
+
},
|
|
594
|
+
"max": {
|
|
595
|
+
"type": "integer"
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
"required": [
|
|
599
|
+
"query"
|
|
600
|
+
],
|
|
601
|
+
"additionalProperties": false
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"name": "libris",
|
|
606
|
+
"description": "Search Libris (Swedish union catalogue) for books: title, author, year, publisher, ISBN. Use to verify a course-book reference.",
|
|
607
|
+
"inputSchema": {
|
|
608
|
+
"type": "object",
|
|
609
|
+
"properties": {
|
|
610
|
+
"query": {
|
|
611
|
+
"type": "string"
|
|
612
|
+
},
|
|
613
|
+
"max": {
|
|
614
|
+
"type": "integer"
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
"required": [
|
|
618
|
+
"query"
|
|
619
|
+
],
|
|
620
|
+
"additionalProperties": false
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
]
|
unitoolkit/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.0"
|
unitoolkit/__main__.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""unitoolkit CLI. Every tool in unitoolkit.tools is a subcommand; output is JSON on stdout.
|
|
2
|
+
|
|
3
|
+
python -m unitoolkit list tools
|
|
4
|
+
python -m unitoolkit <tool> [k=v ...] run a tool (values parsed as JSON when possible)
|
|
5
|
+
python -m unitoolkit <tool> --json '{..}' run a tool with a JSON argument object
|
|
6
|
+
python -m unitoolkit manifest tool schemas (same as tools.json)
|
|
7
|
+
python -m unitoolkit.mcp MCP server over stdio
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
python -m unitoolkit upcoming
|
|
11
|
+
python -m unitoolkit mirror course=all
|
|
12
|
+
python -m unitoolkit pubmed query="person-centred care psychiatry" max=5
|
|
13
|
+
"""
|
|
14
|
+
import json
|
|
15
|
+
import sys
|
|
16
|
+
|
|
17
|
+
from .tools import TOOLS, call, manifest
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def emit(x):
|
|
21
|
+
print(json.dumps(x, ensure_ascii=False, indent=1, default=str))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def parse(rest):
|
|
25
|
+
if rest[:1] == ["--json"]:
|
|
26
|
+
return json.loads(rest[1])
|
|
27
|
+
args = {}
|
|
28
|
+
for kv in rest:
|
|
29
|
+
k, _, v = kv.partition("=")
|
|
30
|
+
try:
|
|
31
|
+
args[k] = json.loads(v)
|
|
32
|
+
except ValueError:
|
|
33
|
+
args[k] = v
|
|
34
|
+
return args
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def main(argv):
|
|
38
|
+
if not argv or argv[0] in ("-h", "--help", "help"):
|
|
39
|
+
print(__doc__)
|
|
40
|
+
for t in TOOLS.values():
|
|
41
|
+
print(f" {t['name']:<20} {t['description'][:80]}")
|
|
42
|
+
return
|
|
43
|
+
if argv[0] == "manifest":
|
|
44
|
+
emit(manifest())
|
|
45
|
+
return
|
|
46
|
+
if argv[0] == "serve":
|
|
47
|
+
from .serve import serve
|
|
48
|
+
opts = parse(argv[1:])
|
|
49
|
+
serve(host=opts.get("host", "127.0.0.1"), port=int(opts.get("port", 8790)))
|
|
50
|
+
return
|
|
51
|
+
try:
|
|
52
|
+
emit(call(argv[0], parse(argv[1:])))
|
|
53
|
+
except KeyError as e:
|
|
54
|
+
sys.exit(str(e))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def cli():
|
|
58
|
+
"""Console-script entry point (`unitoolkit ...` after pip install)."""
|
|
59
|
+
main(sys.argv[1:])
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
main(sys.argv[1:])
|