@ankimcp/anki-mcp-server 0.8.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/LICENSE +7 -0
- package/README.md +756 -0
- package/bin/ankimcp.js +12 -0
- package/dist/anki-config.service.d.ts +10 -0
- package/dist/anki-config.service.js +42 -0
- package/dist/anki-config.service.js.map +1 -0
- package/dist/app.module.d.ts +5 -0
- package/dist/app.module.js +84 -0
- package/dist/app.module.js.map +1 -0
- package/dist/bootstrap.d.ts +3 -0
- package/dist/bootstrap.js +39 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +114 -0
- package/dist/cli.js.map +1 -0
- package/dist/http/guards/origin-validation.guard.d.ts +7 -0
- package/dist/http/guards/origin-validation.guard.js +52 -0
- package/dist/http/guards/origin-validation.guard.js.map +1 -0
- package/dist/main-http.d.ts +1 -0
- package/dist/main-http.js +42 -0
- package/dist/main-http.js.map +1 -0
- package/dist/main-stdio.d.ts +1 -0
- package/dist/main-stdio.js +20 -0
- package/dist/main-stdio.js.map +1 -0
- package/dist/mcp/clients/__mocks__/anki-connect.client.d.ts +6 -0
- package/dist/mcp/clients/__mocks__/anki-connect.client.js +18 -0
- package/dist/mcp/clients/__mocks__/anki-connect.client.js.map +1 -0
- package/dist/mcp/clients/anki-connect.client.d.ts +15 -0
- package/dist/mcp/clients/anki-connect.client.js +145 -0
- package/dist/mcp/clients/anki-connect.client.js.map +1 -0
- package/dist/mcp/config/anki-config.interface.d.ts +7 -0
- package/dist/mcp/config/anki-config.interface.js +5 -0
- package/dist/mcp/config/anki-config.interface.js.map +1 -0
- package/dist/mcp/primitives/essential/index.d.ts +32 -0
- package/dist/mcp/primitives/essential/index.js +130 -0
- package/dist/mcp/primitives/essential/index.js.map +1 -0
- package/dist/mcp/primitives/essential/prompts/review-session.prompt.d.ts +12 -0
- package/dist/mcp/primitives/essential/prompts/review-session.prompt.js +113 -0
- package/dist/mcp/primitives/essential/prompts/review-session.prompt.js.map +1 -0
- package/dist/mcp/primitives/essential/prompts/twenty-rules.prompt/content.md +195 -0
- package/dist/mcp/primitives/essential/prompts/twenty-rules.prompt/index.d.ts +12 -0
- package/dist/mcp/primitives/essential/prompts/twenty-rules.prompt/index.js +89 -0
- package/dist/mcp/primitives/essential/prompts/twenty-rules.prompt/index.js.map +1 -0
- package/dist/mcp/primitives/essential/resources/system-info.resource.d.ts +21 -0
- package/dist/mcp/primitives/essential/resources/system-info.resource.js +115 -0
- package/dist/mcp/primitives/essential/resources/system-info.resource.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/add-note.tool.d.ts +93 -0
- package/dist/mcp/primitives/essential/tools/add-note.tool.js +185 -0
- package/dist/mcp/primitives/essential/tools/add-note.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/create-deck.tool.d.ts +83 -0
- package/dist/mcp/primitives/essential/tools/create-deck.tool.js +121 -0
- package/dist/mcp/primitives/essential/tools/create-deck.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/create-model.tool.d.ts +88 -0
- package/dist/mcp/primitives/essential/tools/create-model.tool.js +144 -0
- package/dist/mcp/primitives/essential/tools/create-model.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/delete-notes.tool.d.ts +84 -0
- package/dist/mcp/primitives/essential/tools/delete-notes.tool.js +120 -0
- package/dist/mcp/primitives/essential/tools/delete-notes.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/find-notes.tool.d.ts +83 -0
- package/dist/mcp/primitives/essential/tools/find-notes.tool.js +106 -0
- package/dist/mcp/primitives/essential/tools/find-notes.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/get-due-cards.tool.d.ts +84 -0
- package/dist/mcp/primitives/essential/tools/get-due-cards.tool.js +108 -0
- package/dist/mcp/primitives/essential/tools/get-due-cards.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/list-decks.tool.d.ts +83 -0
- package/dist/mcp/primitives/essential/tools/list-decks.tool.js +117 -0
- package/dist/mcp/primitives/essential/tools/list-decks.tool.js.map +1 -0
- 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 +141 -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 +83 -0
- package/dist/mcp/primitives/essential/tools/model-field-names.tool.js +119 -0
- package/dist/mcp/primitives/essential/tools/model-field-names.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/model-names.tool.d.ts +81 -0
- package/dist/mcp/primitives/essential/tools/model-names.tool.js +80 -0
- package/dist/mcp/primitives/essential/tools/model-names.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/model-styling.tool.d.ts +83 -0
- package/dist/mcp/primitives/essential/tools/model-styling.tool.js +93 -0
- package/dist/mcp/primitives/essential/tools/model-styling.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/notes-info.tool.d.ts +83 -0
- package/dist/mcp/primitives/essential/tools/notes-info.tool.js +111 -0
- package/dist/mcp/primitives/essential/tools/notes-info.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/present-card.tool.d.ts +84 -0
- package/dist/mcp/primitives/essential/tools/present-card.tool.js +100 -0
- package/dist/mcp/primitives/essential/tools/present-card.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/rate-card.tool.d.ts +84 -0
- package/dist/mcp/primitives/essential/tools/rate-card.tool.js +101 -0
- package/dist/mcp/primitives/essential/tools/rate-card.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/sync.tool.d.ts +81 -0
- package/dist/mcp/primitives/essential/tools/sync.tool.js +61 -0
- package/dist/mcp/primitives/essential/tools/sync.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/update-model-styling.tool.d.ts +84 -0
- package/dist/mcp/primitives/essential/tools/update-model-styling.tool.js +119 -0
- package/dist/mcp/primitives/essential/tools/update-model-styling.tool.js.map +1 -0
- package/dist/mcp/primitives/essential/tools/update-note-fields.tool.d.ts +96 -0
- package/dist/mcp/primitives/essential/tools/update-note-fields.tool.js +154 -0
- package/dist/mcp/primitives/essential/tools/update-note-fields.tool.js.map +1 -0
- package/dist/mcp/primitives/gui/index.d.ts +23 -0
- package/dist/mcp/primitives/gui/index.js +94 -0
- package/dist/mcp/primitives/gui/index.js.map +1 -0
- 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 +99 -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 +88 -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 +80 -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 +90 -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 +83 -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 +180 -0
- package/dist/mcp/types/anki.types.js +18 -0
- package/dist/mcp/types/anki.types.js.map +1 -0
- package/dist/mcp/utils/anki.utils.d.ts +19 -0
- package/dist/mcp/utils/anki.utils.js +157 -0
- package/dist/mcp/utils/anki.utils.js.map +1 -0
- package/dist/mcp/utils/markdown.utils.d.ts +4 -0
- package/dist/mcp/utils/markdown.utils.js +60 -0
- package/dist/mcp/utils/markdown.utils.js.map +1 -0
- package/dist/mcp/utils/mcpb-workarounds.d.ts +1 -0
- package/dist/mcp/utils/mcpb-workarounds.js +13 -0
- package/dist/mcp/utils/mcpb-workarounds.js.map +1 -0
- package/dist/services/ngrok.service.d.ts +15 -0
- package/dist/services/ngrok.service.js +120 -0
- package/dist/services/ngrok.service.js.map +1 -0
- package/dist/test-fixtures/mock-data.d.ts +126 -0
- package/dist/test-fixtures/mock-data.js +112 -0
- package/dist/test-fixtures/mock-data.js.map +1 -0
- package/dist/test-fixtures/test-helpers.d.ts +12 -0
- package/dist/test-fixtures/test-helpers.js +24 -0
- package/dist/test-fixtures/test-helpers.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +168 -0
|
@@ -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: Record<string, never>, 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,83 @@
|
|
|
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") ||
|
|
53
|
+
error.message.includes("not open")) {
|
|
54
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
55
|
+
hint: "Card Browser is not open. Use guiBrowse to open it first.",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
60
|
+
hint: "Make sure Anki is running and the Card Browser is open",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.GuiSelectedNotesTool = GuiSelectedNotesTool;
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, mcp_nest_1.Tool)({
|
|
68
|
+
name: "guiSelectedNotes",
|
|
69
|
+
description: "Get the IDs of notes currently selected in the Card Browser. Returns array of note IDs (empty if no selection). " +
|
|
70
|
+
"IMPORTANT: Only use when user explicitly requests getting selected notes. " +
|
|
71
|
+
"This tool is for note editing/creation workflows, NOT for review sessions. " +
|
|
72
|
+
"The Card Browser must be open with cards selected.",
|
|
73
|
+
parameters: zod_1.z.object({}),
|
|
74
|
+
}),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
77
|
+
__metadata("design:returntype", Promise)
|
|
78
|
+
], GuiSelectedNotesTool.prototype, "guiSelectedNotes", null);
|
|
79
|
+
exports.GuiSelectedNotesTool = GuiSelectedNotesTool = GuiSelectedNotesTool_1 = __decorate([
|
|
80
|
+
(0, common_1.Injectable)(),
|
|
81
|
+
__metadata("design:paramtypes", [anki_connect_client_1.AnkiConnectClient])
|
|
82
|
+
], GuiSelectedNotesTool);
|
|
83
|
+
//# 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,0DAGgC;AAMzB,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAGF;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;I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AAC,QAAQ,CAAC,SAAS,CAAC;oBACjC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAClC,CAAC;oBACD,OAAO,IAAA,gCAAmB,EAAC,KAAK,EAAE;wBAChC,IAAI,EAAE,2DAA2D;qBAClE,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,OAAO,IAAA,gCAAmB,EAAC,KAAK,EAAE;gBAChC,IAAI,EAAE,wDAAwD;aAC/D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAA;AAhEY,oDAAoB;AAczB;IATL,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,kHAAkH;YAClH,4EAA4E;YAC5E,6EAA6E;YAC7E,oDAAoD;QACtD,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KACzB,CAAC;;;;4DAkDD;+BA/DU,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,oBAAoB,CAgEhC"}
|
|
@@ -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 GuiShowAnswerTool {
|
|
4
|
+
private readonly ankiClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(ankiClient: AnkiConnectClient);
|
|
7
|
+
guiShowAnswer(_args: Record<string, never>, 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,0DAGgC;AAMzB,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,KAA4B,EAAE,OAAgB;QAChE,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACvD,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAG3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAU,eAAe,CAAC,CAAC;YAExE,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAE5D,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBACvC,OAAO,IAAA,kCAAqB,EAAC;oBAC3B,OAAO,EAAE,IAAI;oBACb,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,6CAA6C;oBACtD,IAAI,EAAE,kDAAkD;iBACzD,CAAC,CAAC;YACL,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAErC,OAAO,IAAA,kCAAqB,EAAC;gBAC3B,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,8BAA8B;gBACvC,IAAI,EAAE,2EAA2E;aAClF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;YAElD,OAAO,IAAA,gCAAmB,EAAC,KAAK,EAAE;gBAChC,IAAI,EAAE,uEAAuE;aAC9E,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAA;AAlDY,8CAAiB;AActB;IATL,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,4GAA4G;YAC5G,6HAA6H;YAC7H,wGAAwG;YACxG,uEAAuE;QACzE,UAAU,EAAE,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: Record<string, never>, 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,0DAGgC;AAMzB,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAGD;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAE/D,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAWxD,AAAN,KAAK,CAAC,eAAe,CAAC,KAA4B,EAAE,OAAgB;QAClE,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;YACzD,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAG3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAU,i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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: Record<string, never>, 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 GuiUndoTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GuiUndoTool = 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 GuiUndoTool = GuiUndoTool_1 = class GuiUndoTool {
|
|
20
|
+
ankiClient;
|
|
21
|
+
logger = new common_1.Logger(GuiUndoTool_1.name);
|
|
22
|
+
constructor(ankiClient) {
|
|
23
|
+
this.ankiClient = ankiClient;
|
|
24
|
+
}
|
|
25
|
+
async guiUndo(_args, context) {
|
|
26
|
+
try {
|
|
27
|
+
this.logger.log("Undoing last action in Anki");
|
|
28
|
+
await context.reportProgress({ progress: 50, total: 100 });
|
|
29
|
+
const success = await this.ankiClient.invoke("guiUndo");
|
|
30
|
+
await context.reportProgress({ progress: 100, total: 100 });
|
|
31
|
+
if (!success) {
|
|
32
|
+
this.logger.warn("Nothing to undo");
|
|
33
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
34
|
+
success: true,
|
|
35
|
+
undone: false,
|
|
36
|
+
message: "Nothing to undo",
|
|
37
|
+
hint: "There are no recent actions to undo in Anki.",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
this.logger.log("Last action undone successfully");
|
|
41
|
+
return (0, anki_utils_1.createSuccessResponse)({
|
|
42
|
+
success: true,
|
|
43
|
+
undone: true,
|
|
44
|
+
message: "Last action undone successfully",
|
|
45
|
+
hint: "The previous action has been reversed. Check Anki GUI to verify.",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
this.logger.error("Failed to undo action", error);
|
|
50
|
+
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
51
|
+
hint: "Make sure Anki is running and the GUI is visible",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.GuiUndoTool = GuiUndoTool;
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, mcp_nest_1.Tool)({
|
|
59
|
+
name: "guiUndo",
|
|
60
|
+
description: "Undo the last action or card in Anki. Returns true if undo succeeded, false otherwise. " +
|
|
61
|
+
"IMPORTANT: Only use when user explicitly requests undoing an action. " +
|
|
62
|
+
"This tool is for note editing/creation workflows, NOT for review sessions. " +
|
|
63
|
+
"Use this to undo mistakes in note creation, editing, or card management.",
|
|
64
|
+
parameters: zod_1.z.object({}),
|
|
65
|
+
}),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
68
|
+
__metadata("design:returntype", Promise)
|
|
69
|
+
], GuiUndoTool.prototype, "guiUndo", null);
|
|
70
|
+
exports.GuiUndoTool = GuiUndoTool = GuiUndoTool_1 = __decorate([
|
|
71
|
+
(0, common_1.Injectable)(),
|
|
72
|
+
__metadata("design:paramtypes", [anki_connect_client_1.AnkiConnectClient])
|
|
73
|
+
], GuiUndoTool);
|
|
74
|
+
//# sourceMappingURL=gui-undo.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-undo.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/gui/tools/gui-undo.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,0DAGgC;AAMzB,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAGO;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAEvD,YAA6B,UAA6B;QAA7B,eAAU,GAAV,UAAU,CAAmB;IAAG,CAAC;IAWxD,AAAN,KAAK,CAAC,OAAO,CAAC,KAA4B,EAAE,OAAgB;QAC1D,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAC/C,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QA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