anki-mcp-http 0.3.0 → 0.5.0
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.
- package/README.md +2 -0
- package/dist/app.module.js +12 -2
- package/dist/app.module.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +19 -5
- package/dist/cli.js.map +1 -1
- package/dist/main-http.js +1 -0
- package/dist/main-http.js.map +1 -1
- package/dist/mcp/primitives/essential/index.d.ts +1 -0
- package/dist/mcp/primitives/essential/index.js +5 -1
- package/dist/mcp/primitives/essential/index.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/add-note.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/add-note.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/create-deck.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/create-deck.tool.js +2 -1
- package/dist/mcp/primitives/essential/tools/create-deck.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/create-model.tool.d.ts +3 -3
- package/dist/mcp/primitives/essential/tools/create-model.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/delete-notes.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/delete-notes.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/find-notes.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/find-notes.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/get-due-cards.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/get-due-cards.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/list-decks.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/list-decks.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/deleteMediaFile.action.d.ts +10 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/deleteMediaFile.action.js +18 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/deleteMediaFile.action.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/getMediaFilesNames.action.d.ts +12 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/getMediaFilesNames.action.js +22 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/getMediaFilesNames.action.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/retrieveMediaFile.action.d.ts +12 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/retrieveMediaFile.action.js +29 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/retrieveMediaFile.action.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.d.ts +15 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.js +41 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/index.d.ts +5 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/index.js +6 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/index.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.d.ts +89 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.js +135 -0
- package/dist/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/model-field-names.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/model-field-names.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/model-names.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/model-names.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/model-styling.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/model-styling.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/notes-info.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/notes-info.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/present-card.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/present-card.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/rate-card.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/rate-card.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/sync.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/sync.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/update-model-styling.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/update-model-styling.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/update-note-fields.tool.d.ts +2 -2
- package/dist/mcp/primitives/essential/tools/update-note-fields.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/index.d.ts +21 -2
- package/dist/mcp/primitives/gui/index.js +73 -5
- package/dist/mcp/primitives/gui/index.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-add-cards.tool.d.ts +88 -0
- package/dist/mcp/primitives/gui/tools/gui-add-cards.tool.js +111 -0
- package/dist/mcp/primitives/gui/tools/gui-add-cards.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-browse.tool.d.ts +87 -0
- package/dist/mcp/primitives/gui/tools/gui-browse.tool.js +98 -0
- package/dist/mcp/primitives/gui/tools/gui-browse.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-current-card.tool.d.ts +81 -0
- package/dist/mcp/primitives/gui/tools/gui-current-card.tool.js +76 -0
- package/dist/mcp/primitives/gui/tools/gui-current-card.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-deck-browser.tool.d.ts +81 -0
- package/dist/mcp/primitives/gui/tools/gui-deck-browser.tool.js +64 -0
- package/dist/mcp/primitives/gui/tools/gui-deck-browser.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-deck-overview.tool.d.ts +83 -0
- package/dist/mcp/primitives/gui/tools/gui-deck-overview.tool.js +85 -0
- package/dist/mcp/primitives/gui/tools/gui-deck-overview.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-edit-note.tool.d.ts +83 -0
- package/dist/mcp/primitives/gui/tools/gui-edit-note.tool.js +79 -0
- package/dist/mcp/primitives/gui/tools/gui-edit-note.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-select-card.tool.d.ts +83 -0
- package/dist/mcp/primitives/gui/tools/gui-select-card.tool.js +87 -0
- package/dist/mcp/primitives/gui/tools/gui-select-card.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-selected-notes.tool.d.ts +81 -0
- package/dist/mcp/primitives/gui/tools/gui-selected-notes.tool.js +82 -0
- package/dist/mcp/primitives/gui/tools/gui-selected-notes.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-show-answer.tool.d.ts +81 -0
- package/dist/mcp/primitives/gui/tools/gui-show-answer.tool.js +74 -0
- package/dist/mcp/primitives/gui/tools/gui-show-answer.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-show-question.tool.d.ts +81 -0
- package/dist/mcp/primitives/gui/tools/gui-show-question.tool.js +74 -0
- package/dist/mcp/primitives/gui/tools/gui-show-question.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/tools/gui-undo.tool.d.ts +81 -0
- package/dist/mcp/primitives/gui/tools/gui-undo.tool.js +74 -0
- package/dist/mcp/primitives/gui/tools/gui-undo.tool.js.map +1 -0
- package/dist/mcp/types/anki.types.d.ts +28 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +13 -7
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GuiSelectCardTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GuiSelectCardTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const mcp_nest_1 = require("@rekog/mcp-nest");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const anki_connect_client_1 = require("../../../clients/anki-connect.client");
|
|
18
|
+
const anki_utils_1 = require("../../../utils/anki.utils");
|
|
19
|
+
let GuiSelectCardTool = GuiSelectCardTool_1 = class GuiSelectCardTool {
|
|
20
|
+
ankiClient;
|
|
21
|
+
logger = new common_1.Logger(GuiSelectCardTool_1.name);
|
|
22
|
+
constructor(ankiClient) {
|
|
23
|
+
this.ankiClient = ankiClient;
|
|
24
|
+
}
|
|
25
|
+
async guiSelectCard({ card }, context) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log(`Selecting card ${card} in Card Browser`);
|
|
28
|
+
await context.reportProgress({ progress: 50, total: 100 });
|
|
29
|
+
const success = await this.ankiClient.invoke('guiSelectCard', { card });
|
|
30
|
+
await context.reportProgress({ progress: 100, total: 100 });
|
|
31
|
+
if (!success) {
|
|
32
|
+
this.logger.warn('Card Browser is not open');
|
|
33
|
+
return (0, anki_utils_1.createErrorResponse)(new Error('Card Browser is not open'), {
|
|
34
|
+
cardId: card,
|
|
35
|
+
hint: 'Use guiBrowse to open the Card Browser first, then try selecting the card again.',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
this.logger.log(`Successfully selected card ${card} in Card Browser`);
|
|
39
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
40
|
+
success: true,
|
|
41
|
+
cardId: card,
|
|
42
|
+
browserOpen: true,
|
|
43
|
+
message: `Successfully selected card ${card} in Card Browser`,
|
|
44
|
+
hint: 'The card is now selected. Use guiEditNote to edit the associated note, or guiSelectedNotes to get note IDs.',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
this.logger.error('Failed to select card in browser', error);
|
|
49
|
+
if (error instanceof Error) {
|
|
50
|
+
if (error.message.includes('not found') || error.message.includes('invalid')) {
|
|
51
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
52
|
+
cardId: card,
|
|
53
|
+
hint: 'Card ID not found. Make sure the card exists and is visible in the current browser search.',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
58
|
+
cardId: card,
|
|
59
|
+
hint: 'Make sure Anki is running, the Card Browser is open, and the card ID is valid',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.GuiSelectCardTool = GuiSelectCardTool;
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, mcp_nest_1.Tool)({
|
|
67
|
+
name: 'guiSelectCard',
|
|
68
|
+
description: 'Select a specific card in an open Card Browser window. Returns true if browser is open and card was selected, false if browser is not open. ' +
|
|
69
|
+
'IMPORTANT: Only use when user explicitly requests selecting a card in the browser. ' +
|
|
70
|
+
'This tool is for note editing/creation workflows, NOT for review sessions. ' +
|
|
71
|
+
'The Card Browser must already be open (use guiBrowse first).',
|
|
72
|
+
parameters: zod_1.z.object({
|
|
73
|
+
card: zod_1.z
|
|
74
|
+
.number()
|
|
75
|
+
.positive()
|
|
76
|
+
.describe('Card ID to select in the browser (get from guiBrowse results)'),
|
|
77
|
+
}),
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", Function),
|
|
80
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
81
|
+
__metadata("design:returntype", Promise)
|
|
82
|
+
], GuiSelectCardTool.prototype, "guiSelectCard", null);
|
|
83
|
+
exports.GuiSelectCardTool = GuiSelectCardTool = GuiSelectCardTool_1 = __decorate([
|
|
84
|
+
(0, common_1.Injectable)(),
|
|
85
|
+
__metadata("design:paramtypes", [anki_connect_client_1.AnkiConnectClient])
|
|
86
|
+
], GuiSelectCardTool);
|
|
87
|
+
//# sourceMappingURL=gui-select-card.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-select-card.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/gui/tools/gui-select-card.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,0DAAoF;AAM7E,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAGC;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAE7D,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAgBxD,AAAN,KAAK,CAAC,aAAa,CAAC,EAAE,IAAI,EAAoB,EAAE,OAAgB;QAC9D,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,CAAC;YAC1D,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAG3D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAU,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAEjF,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAE5D,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,I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AI,EAAE,OAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,+DAA+D,CAAC;SAC7E,CAAC;KACH,CAAC;;;;sDAgDD;4BAlEU,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,iBAAiB,CAmE7B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Context } from '@rekog/mcp-nest';
|
|
2
|
+
import { AnkiConnectClient } from '@/mcp/clients/anki-connect.client';
|
|
3
|
+
export declare class GuiSelectedNotesTool {
|
|
4
|
+
private readonly ankiClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(ankiClient: AnkiConnectClient);
|
|
7
|
+
guiSelectedNotes(_args: {}, context: Context): Promise<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
content: ({
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
_meta?: {
|
|
14
|
+
[x: string]: unknown;
|
|
15
|
+
} | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
[x: string]: unknown;
|
|
18
|
+
type: "image";
|
|
19
|
+
data: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
_meta?: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
} | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
type: "audio";
|
|
27
|
+
data: string;
|
|
28
|
+
mimeType: string;
|
|
29
|
+
_meta?: {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
} | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
type: "resource_link";
|
|
35
|
+
name: string;
|
|
36
|
+
uri: string;
|
|
37
|
+
_meta?: {
|
|
38
|
+
[x: string]: unknown;
|
|
39
|
+
} | undefined;
|
|
40
|
+
mimeType?: string | undefined;
|
|
41
|
+
title?: string | undefined;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
icons?: {
|
|
44
|
+
[x: string]: unknown;
|
|
45
|
+
src: string;
|
|
46
|
+
mimeType?: string | undefined;
|
|
47
|
+
sizes?: string[] | undefined;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
[x: string]: unknown;
|
|
51
|
+
type: "resource";
|
|
52
|
+
resource: {
|
|
53
|
+
[x: string]: unknown;
|
|
54
|
+
text: string;
|
|
55
|
+
uri: string;
|
|
56
|
+
_meta?: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
} | undefined;
|
|
59
|
+
mimeType?: string | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
[x: string]: unknown;
|
|
62
|
+
uri: string;
|
|
63
|
+
blob: string;
|
|
64
|
+
_meta?: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
} | undefined;
|
|
67
|
+
mimeType?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
_meta?: {
|
|
70
|
+
[x: string]: unknown;
|
|
71
|
+
} | undefined;
|
|
72
|
+
})[];
|
|
73
|
+
_meta?: {
|
|
74
|
+
[x: string]: unknown;
|
|
75
|
+
} | undefined;
|
|
76
|
+
structuredContent?: {
|
|
77
|
+
[x: string]: unknown;
|
|
78
|
+
} | undefined;
|
|
79
|
+
isError?: boolean | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GuiSelectedNotesTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GuiSelectedNotesTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const mcp_nest_1 = require("@rekog/mcp-nest");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const anki_connect_client_1 = require("../../../clients/anki-connect.client");
|
|
18
|
+
const anki_utils_1 = require("../../../utils/anki.utils");
|
|
19
|
+
let GuiSelectedNotesTool = GuiSelectedNotesTool_1 = class GuiSelectedNotesTool {
|
|
20
|
+
ankiClient;
|
|
21
|
+
logger = new common_1.Logger(GuiSelectedNotesTool_1.name);
|
|
22
|
+
constructor(ankiClient) {
|
|
23
|
+
this.ankiClient = ankiClient;
|
|
24
|
+
}
|
|
25
|
+
async guiSelectedNotes(_args, context) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log('Getting selected notes from Card Browser');
|
|
28
|
+
await context.reportProgress({ progress: 50, total: 100 });
|
|
29
|
+
const noteIds = await this.ankiClient.invoke('guiSelectedNotes');
|
|
30
|
+
await context.reportProgress({ progress: 100, total: 100 });
|
|
31
|
+
this.logger.log(`Retrieved ${noteIds.length} selected note(s) from Card Browser`);
|
|
32
|
+
if (noteIds.length === 0) {
|
|
33
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
34
|
+
success: true,
|
|
35
|
+
noteIds: [],
|
|
36
|
+
noteCount: 0,
|
|
37
|
+
message: 'No notes are currently selected in the Card Browser',
|
|
38
|
+
hint: 'Open the Card Browser (guiBrowse) and select some cards/notes first.',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
42
|
+
success: true,
|
|
43
|
+
noteIds,
|
|
44
|
+
noteCount: noteIds.length,
|
|
45
|
+
message: `Retrieved ${noteIds.length} selected note ID(s) from Card Browser`,
|
|
46
|
+
hint: 'Use notesInfo to get details about these notes, or updateNoteFields/deleteNotes to modify them.',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
this.logger.error('Failed to get selected notes', error);
|
|
51
|
+
if (error instanceof Error) {
|
|
52
|
+
if (error.message.includes('browser') || error.message.includes('not open')) {
|
|
53
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
54
|
+
hint: 'Card Browser is not open. Use guiBrowse to open it first.',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
59
|
+
hint: 'Make sure Anki is running and the Card Browser is open',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.GuiSelectedNotesTool = GuiSelectedNotesTool;
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, mcp_nest_1.Tool)({
|
|
67
|
+
name: 'guiSelectedNotes',
|
|
68
|
+
description: 'Get the IDs of notes currently selected in the Card Browser. Returns array of note IDs (empty if no selection). ' +
|
|
69
|
+
'IMPORTANT: Only use when user explicitly requests getting selected notes. ' +
|
|
70
|
+
'This tool is for note editing/creation workflows, NOT for review sessions. ' +
|
|
71
|
+
'The Card Browser must be open with cards selected.',
|
|
72
|
+
parameters: zod_1.z.object({}),
|
|
73
|
+
}),
|
|
74
|
+
__metadata("design:type", Function),
|
|
75
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
76
|
+
__metadata("design:returntype", Promise)
|
|
77
|
+
], GuiSelectedNotesTool.prototype, "guiSelectedNotes", null);
|
|
78
|
+
exports.GuiSelectedNotesTool = GuiSelectedNotesTool = GuiSelectedNotesTool_1 = __decorate([
|
|
79
|
+
(0, common_1.Injectable)(),
|
|
80
|
+
__metadata("design:paramtypes", [anki_connect_client_1.AnkiConnectClient])
|
|
81
|
+
], GuiSelectedNotesTool);
|
|
82
|
+
//# sourceMappingURL=gui-selected-notes.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-selected-notes.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/gui/tools/gui-selected-notes.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,0DAAoF;AAM7E,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAGF;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;IAEhE,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAWxD,AAAN,KAAK,CAAC,gBAAgB,CAAC,KAAS,EAAE,OAAgB;QAChD,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;YAC5D,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAG3D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAW,kBAAkB,CAAC,CAAC;YAE3E,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAC5D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,MAAM,qCAAqC,CAAC,CAAC;YAElF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,IAAA,kCAAqB,EAAC;oBAC3B,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,CAAC;oBACZ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';
|
|
3
|
+
export declare class GuiShowAnswerTool {
|
|
4
|
+
private readonly ankiClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(ankiClient: AnkiConnectClient);
|
|
7
|
+
guiShowAnswer(_args: {}, context: Context): Promise<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
content: ({
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
_meta?: {
|
|
14
|
+
[x: string]: unknown;
|
|
15
|
+
} | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
[x: string]: unknown;
|
|
18
|
+
type: "image";
|
|
19
|
+
data: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
_meta?: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
} | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
type: "audio";
|
|
27
|
+
data: string;
|
|
28
|
+
mimeType: string;
|
|
29
|
+
_meta?: {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
} | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
type: "resource_link";
|
|
35
|
+
name: string;
|
|
36
|
+
uri: string;
|
|
37
|
+
_meta?: {
|
|
38
|
+
[x: string]: unknown;
|
|
39
|
+
} | undefined;
|
|
40
|
+
mimeType?: string | undefined;
|
|
41
|
+
title?: string | undefined;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
icons?: {
|
|
44
|
+
[x: string]: unknown;
|
|
45
|
+
src: string;
|
|
46
|
+
mimeType?: string | undefined;
|
|
47
|
+
sizes?: string[] | undefined;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
[x: string]: unknown;
|
|
51
|
+
type: "resource";
|
|
52
|
+
resource: {
|
|
53
|
+
[x: string]: unknown;
|
|
54
|
+
text: string;
|
|
55
|
+
uri: string;
|
|
56
|
+
_meta?: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
} | undefined;
|
|
59
|
+
mimeType?: string | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
[x: string]: unknown;
|
|
62
|
+
uri: string;
|
|
63
|
+
blob: string;
|
|
64
|
+
_meta?: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
} | undefined;
|
|
67
|
+
mimeType?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
_meta?: {
|
|
70
|
+
[x: string]: unknown;
|
|
71
|
+
} | undefined;
|
|
72
|
+
})[];
|
|
73
|
+
_meta?: {
|
|
74
|
+
[x: string]: unknown;
|
|
75
|
+
} | undefined;
|
|
76
|
+
structuredContent?: {
|
|
77
|
+
[x: string]: unknown;
|
|
78
|
+
} | undefined;
|
|
79
|
+
isError?: boolean | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GuiShowAnswerTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GuiShowAnswerTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const mcp_nest_1 = require("@rekog/mcp-nest");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const anki_connect_client_1 = require("../../../clients/anki-connect.client");
|
|
18
|
+
const anki_utils_1 = require("../../../utils/anki.utils");
|
|
19
|
+
let GuiShowAnswerTool = GuiShowAnswerTool_1 = class GuiShowAnswerTool {
|
|
20
|
+
ankiClient;
|
|
21
|
+
logger = new common_1.Logger(GuiShowAnswerTool_1.name);
|
|
22
|
+
constructor(ankiClient) {
|
|
23
|
+
this.ankiClient = ankiClient;
|
|
24
|
+
}
|
|
25
|
+
async guiShowAnswer(_args, context) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log('Showing answer side of current card');
|
|
28
|
+
await context.reportProgress({ progress: 50, total: 100 });
|
|
29
|
+
const inReview = await this.ankiClient.invoke('guiShowAnswer');
|
|
30
|
+
await context.reportProgress({ progress: 100, total: 100 });
|
|
31
|
+
if (!inReview) {
|
|
32
|
+
this.logger.warn('Not in review mode');
|
|
33
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
34
|
+
success: true,
|
|
35
|
+
inReview: false,
|
|
36
|
+
message: 'Not in review mode - answer cannot be shown',
|
|
37
|
+
hint: 'Start reviewing a deck in Anki to use this tool.',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
this.logger.log('Answer side shown');
|
|
41
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
42
|
+
success: true,
|
|
43
|
+
inReview: true,
|
|
44
|
+
message: 'Answer side is now displayed',
|
|
45
|
+
hint: 'Use guiCurrentCard to get full card details including the answer content.',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
this.logger.error('Failed to show answer', error);
|
|
50
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
51
|
+
hint: 'Make sure Anki is running, GUI is visible, and you are in review mode',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.GuiShowAnswerTool = GuiShowAnswerTool;
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, mcp_nest_1.Tool)({
|
|
59
|
+
name: 'guiShowAnswer',
|
|
60
|
+
description: 'Show the answer side of the current card in review mode. Returns true if in review mode, false otherwise. ' +
|
|
61
|
+
'CRITICAL: This tool is ONLY for note editing/creation workflows when user needs to view the answer side to verify content. ' +
|
|
62
|
+
'NEVER use this for conducting review sessions. Use the dedicated review tools (present_card) instead. ' +
|
|
63
|
+
'IMPORTANT: Only use when user explicitly requests showing the answer.',
|
|
64
|
+
parameters: zod_1.z.object({}),
|
|
65
|
+
}),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
68
|
+
__metadata("design:returntype", Promise)
|
|
69
|
+
], GuiShowAnswerTool.prototype, "guiShowAnswer", null);
|
|
70
|
+
exports.GuiShowAnswerTool = GuiShowAnswerTool = GuiShowAnswerTool_1 = __decorate([
|
|
71
|
+
(0, common_1.Injectable)(),
|
|
72
|
+
__metadata("design:paramtypes", [anki_connect_client_1.AnkiConnectClient])
|
|
73
|
+
], GuiShowAnswerTool);
|
|
74
|
+
//# sourceMappingURL=gui-show-answer.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-show-answer.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/gui/tools/gui-show-answer.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,0DAAoF;AAM7E,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAGC;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAE7D,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAWxD,AAAN,KAAK,CAAC,aAAa,CAAC,KAAS,EAAE,OAAgB;QAC7C,IAAI,CAAC;YACH,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,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KACzB,CAAC;;;;sDAoCD;4BAjDU,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,iBAAiB,CAkD7B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Context } from '@rekog/mcp-nest';
|
|
2
|
+
import { AnkiConnectClient } from '@/mcp/clients/anki-connect.client';
|
|
3
|
+
export declare class GuiShowQuestionTool {
|
|
4
|
+
private readonly ankiClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(ankiClient: AnkiConnectClient);
|
|
7
|
+
guiShowQuestion(_args: {}, context: Context): Promise<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
content: ({
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
_meta?: {
|
|
14
|
+
[x: string]: unknown;
|
|
15
|
+
} | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
[x: string]: unknown;
|
|
18
|
+
type: "image";
|
|
19
|
+
data: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
_meta?: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
} | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
type: "audio";
|
|
27
|
+
data: string;
|
|
28
|
+
mimeType: string;
|
|
29
|
+
_meta?: {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
} | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
type: "resource_link";
|
|
35
|
+
name: string;
|
|
36
|
+
uri: string;
|
|
37
|
+
_meta?: {
|
|
38
|
+
[x: string]: unknown;
|
|
39
|
+
} | undefined;
|
|
40
|
+
mimeType?: string | undefined;
|
|
41
|
+
title?: string | undefined;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
icons?: {
|
|
44
|
+
[x: string]: unknown;
|
|
45
|
+
src: string;
|
|
46
|
+
mimeType?: string | undefined;
|
|
47
|
+
sizes?: string[] | undefined;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
[x: string]: unknown;
|
|
51
|
+
type: "resource";
|
|
52
|
+
resource: {
|
|
53
|
+
[x: string]: unknown;
|
|
54
|
+
text: string;
|
|
55
|
+
uri: string;
|
|
56
|
+
_meta?: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
} | undefined;
|
|
59
|
+
mimeType?: string | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
[x: string]: unknown;
|
|
62
|
+
uri: string;
|
|
63
|
+
blob: string;
|
|
64
|
+
_meta?: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
} | undefined;
|
|
67
|
+
mimeType?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
_meta?: {
|
|
70
|
+
[x: string]: unknown;
|
|
71
|
+
} | undefined;
|
|
72
|
+
})[];
|
|
73
|
+
_meta?: {
|
|
74
|
+
[x: string]: unknown;
|
|
75
|
+
} | undefined;
|
|
76
|
+
structuredContent?: {
|
|
77
|
+
[x: string]: unknown;
|
|
78
|
+
} | undefined;
|
|
79
|
+
isError?: boolean | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GuiShowQuestionTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GuiShowQuestionTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const mcp_nest_1 = require("@rekog/mcp-nest");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const anki_connect_client_1 = require("../../../clients/anki-connect.client");
|
|
18
|
+
const anki_utils_1 = require("../../../utils/anki.utils");
|
|
19
|
+
let GuiShowQuestionTool = GuiShowQuestionTool_1 = class GuiShowQuestionTool {
|
|
20
|
+
ankiClient;
|
|
21
|
+
logger = new common_1.Logger(GuiShowQuestionTool_1.name);
|
|
22
|
+
constructor(ankiClient) {
|
|
23
|
+
this.ankiClient = ankiClient;
|
|
24
|
+
}
|
|
25
|
+
async guiShowQuestion(_args, context) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log('Showing question side of current card');
|
|
28
|
+
await context.reportProgress({ progress: 50, total: 100 });
|
|
29
|
+
const inReview = await this.ankiClient.invoke('guiShowQuestion');
|
|
30
|
+
await context.reportProgress({ progress: 100, total: 100 });
|
|
31
|
+
if (!inReview) {
|
|
32
|
+
this.logger.warn('Not in review mode');
|
|
33
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
34
|
+
success: true,
|
|
35
|
+
inReview: false,
|
|
36
|
+
message: 'Not in review mode - question cannot be shown',
|
|
37
|
+
hint: 'Start reviewing a deck in Anki to use this tool.',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
this.logger.log('Question side shown');
|
|
41
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
42
|
+
success: true,
|
|
43
|
+
inReview: true,
|
|
44
|
+
message: 'Question side is now displayed',
|
|
45
|
+
hint: 'Use guiCurrentCard to get the card details, or guiShowAnswer to reveal the answer.',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
this.logger.error('Failed to show question', error);
|
|
50
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
51
|
+
hint: 'Make sure Anki is running, GUI is visible, and you are in review mode',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.GuiShowQuestionTool = GuiShowQuestionTool;
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, mcp_nest_1.Tool)({
|
|
59
|
+
name: 'guiShowQuestion',
|
|
60
|
+
description: 'Show the question side of the current card in review mode. Returns true if in review mode, false otherwise. ' +
|
|
61
|
+
'CRITICAL: This tool is ONLY for note editing/creation workflows when user needs to view the question side to verify content. ' +
|
|
62
|
+
'NEVER use this for conducting review sessions. Use the dedicated review tools (present_card) instead. ' +
|
|
63
|
+
'IMPORTANT: Only use when user explicitly requests showing the question.',
|
|
64
|
+
parameters: zod_1.z.object({}),
|
|
65
|
+
}),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
68
|
+
__metadata("design:returntype", Promise)
|
|
69
|
+
], GuiShowQuestionTool.prototype, "guiShowQuestion", null);
|
|
70
|
+
exports.GuiShowQuestionTool = GuiShowQuestionTool = GuiShowQuestionTool_1 = __decorate([
|
|
71
|
+
(0, common_1.Injectable)(),
|
|
72
|
+
__metadata("design:paramtypes", [anki_connect_client_1.AnkiConnectClient])
|
|
73
|
+
], GuiShowQuestionTool);
|
|
74
|
+
//# sourceMappingURL=gui-show-question.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-show-question.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/gui/tools/gui-show-question.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,0DAAoF;AAM7E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,IAAA,gCAAmB,EAAC,KAAK,EAAE;gBAChC,IAAI,EAAE,uEAAuE;aAC9E,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAA;AAlDY,kDAAmB;AAcxB;IATL,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,8GAA8G;YAC9G,+HAA+H;YAC/H,wGAAwG;YACxG,yEAAyE;QAC3E,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KACzB,CAAC;;;;0DAoCD;8BAjDU,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,mBAAmB,CAkD/B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Context } from '@rekog/mcp-nest';
|
|
2
|
+
import { AnkiConnectClient } from '@/mcp/clients/anki-connect.client';
|
|
3
|
+
export declare class GuiUndoTool {
|
|
4
|
+
private readonly ankiClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(ankiClient: AnkiConnectClient);
|
|
7
|
+
guiUndo(_args: {}, context: Context): Promise<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
content: ({
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
_meta?: {
|
|
14
|
+
[x: string]: unknown;
|
|
15
|
+
} | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
[x: string]: unknown;
|
|
18
|
+
type: "image";
|
|
19
|
+
data: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
_meta?: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
} | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
type: "audio";
|
|
27
|
+
data: string;
|
|
28
|
+
mimeType: string;
|
|
29
|
+
_meta?: {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
} | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
type: "resource_link";
|
|
35
|
+
name: string;
|
|
36
|
+
uri: string;
|
|
37
|
+
_meta?: {
|
|
38
|
+
[x: string]: unknown;
|
|
39
|
+
} | undefined;
|
|
40
|
+
mimeType?: string | undefined;
|
|
41
|
+
title?: string | undefined;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
icons?: {
|
|
44
|
+
[x: string]: unknown;
|
|
45
|
+
src: string;
|
|
46
|
+
mimeType?: string | undefined;
|
|
47
|
+
sizes?: string[] | undefined;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
[x: string]: unknown;
|
|
51
|
+
type: "resource";
|
|
52
|
+
resource: {
|
|
53
|
+
[x: string]: unknown;
|
|
54
|
+
text: string;
|
|
55
|
+
uri: string;
|
|
56
|
+
_meta?: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
} | undefined;
|
|
59
|
+
mimeType?: string | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
[x: string]: unknown;
|
|
62
|
+
uri: string;
|
|
63
|
+
blob: string;
|
|
64
|
+
_meta?: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
} | undefined;
|
|
67
|
+
mimeType?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
_meta?: {
|
|
70
|
+
[x: string]: unknown;
|
|
71
|
+
} | undefined;
|
|
72
|
+
})[];
|
|
73
|
+
_meta?: {
|
|
74
|
+
[x: string]: unknown;
|
|
75
|
+
} | undefined;
|
|
76
|
+
structuredContent?: {
|
|
77
|
+
[x: string]: unknown;
|
|
78
|
+
} | undefined;
|
|
79
|
+
isError?: boolean | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
}
|