anki-mcp-http 0.8.0 → 0.8.1
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 +5 -19
- package/README.md +74 -35
- package/dist/anki-config.service.d.ts +2 -2
- package/dist/anki-config.service.js +4 -4
- package/dist/app.module.d.ts +1 -1
- package/dist/app.module.js +7 -7
- package/dist/app.module.js.map +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.js +4 -4
- package/dist/cli.js +13 -13
- package/dist/cli.js.map +1 -1
- package/dist/http/guards/origin-validation.guard.d.ts +1 -1
- package/dist/http/guards/origin-validation.guard.js +5 -5
- package/dist/main-http.js +3 -3
- package/dist/main-http.js.map +1 -1
- package/dist/main-stdio.js +2 -2
- package/dist/mcp/clients/__mocks__/anki-connect.client.js +1 -1
- package/dist/mcp/clients/anki-connect.client.d.ts +1 -1
- package/dist/mcp/clients/anki-connect.client.js +7 -7
- package/dist/mcp/config/anki-config.interface.js +1 -1
- package/dist/mcp/primitives/essential/index.d.ts +26 -26
- package/dist/mcp/primitives/essential/index.js +1 -4
- package/dist/mcp/primitives/essential/index.js.map +1 -1
- package/dist/mcp/primitives/essential/prompts/review-session.prompt.js +5 -5
- package/dist/mcp/primitives/essential/prompts/review-session.prompt.js.map +1 -1
- package/dist/mcp/primitives/essential/prompts/twenty-rules.prompt/index.js +10 -8
- package/dist/mcp/primitives/essential/prompts/twenty-rules.prompt/index.js.map +1 -1
- package/dist/mcp/primitives/essential/resources/system-info.resource.js +12 -12
- package/dist/mcp/primitives/essential/tools/add-note.tool.d.ts +3 -3
- package/dist/mcp/primitives/essential/tools/add-note.tool.js +27 -30
- 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 +15 -15
- 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 +20 -18
- 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 +22 -22
- 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 +14 -14
- 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 +17 -15
- 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 +10 -10
- 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 +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/deleteMediaFile.action.js +3 -3
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/getMediaFilesNames.action.d.ts +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/getMediaFilesNames.action.js +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/getMediaFilesNames.action.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/retrieveMediaFile.action.d.ts +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/retrieveMediaFile.action.js +3 -3
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.d.ts +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.js +7 -7
- package/dist/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/index.d.ts +5 -5
- package/dist/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.d.ts +3 -3
- package/dist/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.js +23 -17
- package/dist/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.js.map +1 -1
- 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 +20 -17
- 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 +3 -3
- package/dist/mcp/primitives/essential/tools/model-names.tool.js +13 -11
- 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 +11 -11
- 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 +19 -19
- 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 +11 -11
- 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 +19 -14
- package/dist/mcp/primitives/essential/tools/rate-card.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/sync.tool.d.ts +3 -3
- package/dist/mcp/primitives/essential/tools/sync.tool.js +8 -8
- 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 +19 -19
- 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 +3 -3
- package/dist/mcp/primitives/essential/tools/update-note-fields.tool.js +32 -32
- package/dist/mcp/primitives/essential/tools/update-note-fields.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/index.d.ts +17 -17
- package/dist/mcp/primitives/gui/index.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-add-cards.tool.d.ts +2 -2
- package/dist/mcp/primitives/gui/tools/gui-add-cards.tool.js +22 -22
- package/dist/mcp/primitives/gui/tools/gui-add-cards.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-browse.tool.d.ts +3 -3
- package/dist/mcp/primitives/gui/tools/gui-browse.tool.js +15 -14
- package/dist/mcp/primitives/gui/tools/gui-browse.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-current-card.tool.d.ts +3 -3
- package/dist/mcp/primitives/gui/tools/gui-current-card.tool.js +13 -13
- package/dist/mcp/primitives/gui/tools/gui-current-card.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-deck-browser.tool.d.ts +3 -3
- package/dist/mcp/primitives/gui/tools/gui-deck-browser.tool.js +12 -12
- package/dist/mcp/primitives/gui/tools/gui-deck-browser.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-deck-overview.tool.d.ts +2 -2
- package/dist/mcp/primitives/gui/tools/gui-deck-overview.tool.js +15 -12
- package/dist/mcp/primitives/gui/tools/gui-deck-overview.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-edit-note.tool.d.ts +2 -2
- package/dist/mcp/primitives/gui/tools/gui-edit-note.tool.js +13 -12
- package/dist/mcp/primitives/gui/tools/gui-edit-note.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-select-card.tool.d.ts +2 -2
- package/dist/mcp/primitives/gui/tools/gui-select-card.tool.js +18 -15
- package/dist/mcp/primitives/gui/tools/gui-select-card.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-selected-notes.tool.d.ts +3 -3
- package/dist/mcp/primitives/gui/tools/gui-selected-notes.tool.js +15 -14
- package/dist/mcp/primitives/gui/tools/gui-selected-notes.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-show-answer.tool.d.ts +3 -3
- package/dist/mcp/primitives/gui/tools/gui-show-answer.tool.js +15 -15
- package/dist/mcp/primitives/gui/tools/gui-show-answer.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-show-question.tool.d.ts +3 -3
- package/dist/mcp/primitives/gui/tools/gui-show-question.tool.js +15 -15
- package/dist/mcp/primitives/gui/tools/gui-show-question.tool.js.map +1 -1
- package/dist/mcp/primitives/gui/tools/gui-undo.tool.d.ts +3 -3
- package/dist/mcp/primitives/gui/tools/gui-undo.tool.js +15 -15
- package/dist/mcp/primitives/gui/tools/gui-undo.tool.js.map +1 -1
- package/dist/mcp/types/anki.types.d.ts +2 -2
- package/dist/mcp/utils/anki.utils.d.ts +3 -3
- package/dist/mcp/utils/anki.utils.js +42 -38
- package/dist/mcp/utils/anki.utils.js.map +1 -1
- package/dist/mcp/utils/markdown.utils.js +16 -12
- package/dist/mcp/utils/markdown.utils.js.map +1 -1
- package/dist/mcp/utils/mcpb-workarounds.js +2 -2
- package/dist/mcp/utils/mcpb-workarounds.js.map +1 -1
- package/dist/services/ngrok.service.js +30 -30
- package/dist/services/ngrok.service.js.map +1 -1
- package/dist/test-fixtures/mock-data.d.ts +2 -2
- package/dist/test-fixtures/mock-data.js +46 -46
- package/dist/test-fixtures/mock-data.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +12 -7
package/dist/mcp/primitives/essential/tools/mediaActions/actions/retrieveMediaFile.action.js
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.retrieveMediaFile = retrieveMediaFile;
|
|
4
4
|
async function retrieveMediaFile(params, client) {
|
|
5
5
|
const { filename } = params;
|
|
6
|
-
if (!filename || filename.trim() ===
|
|
7
|
-
throw new Error(
|
|
6
|
+
if (!filename || filename.trim() === "") {
|
|
7
|
+
throw new Error("Filename cannot be empty");
|
|
8
8
|
}
|
|
9
|
-
const result = await client.invoke(
|
|
9
|
+
const result = await client.invoke("retrieveMediaFile", {
|
|
10
10
|
filename,
|
|
11
11
|
});
|
|
12
12
|
if (result === false) {
|
|
@@ -4,16 +4,16 @@ exports.storeMediaFile = storeMediaFile;
|
|
|
4
4
|
async function storeMediaFile(params, client) {
|
|
5
5
|
const { filename, data, path, url, deleteExisting = true } = params;
|
|
6
6
|
if (!data && !path && !url) {
|
|
7
|
-
throw new Error(
|
|
7
|
+
throw new Error("Must provide either data, path, or url parameter");
|
|
8
8
|
}
|
|
9
9
|
const sources = [data, path, url].filter(Boolean);
|
|
10
10
|
if (sources.length > 1) {
|
|
11
|
-
throw new Error(
|
|
11
|
+
throw new Error("Cannot provide multiple sources (data, path, url). Choose one.");
|
|
12
12
|
}
|
|
13
|
-
if (!filename || filename.trim() ===
|
|
14
|
-
throw new Error(
|
|
13
|
+
if (!filename || filename.trim() === "") {
|
|
14
|
+
throw new Error("Filename cannot be empty");
|
|
15
15
|
}
|
|
16
|
-
const prefixedWithUnderscore = filename.startsWith(
|
|
16
|
+
const prefixedWithUnderscore = filename.startsWith("_");
|
|
17
17
|
const ankiParams = {
|
|
18
18
|
filename,
|
|
19
19
|
deleteExisting,
|
|
@@ -27,9 +27,9 @@ async function storeMediaFile(params, client) {
|
|
|
27
27
|
else if (url) {
|
|
28
28
|
ankiParams.url = url;
|
|
29
29
|
}
|
|
30
|
-
const result = await client.invoke(
|
|
30
|
+
const result = await client.invoke("storeMediaFile", ankiParams);
|
|
31
31
|
if (!result) {
|
|
32
|
-
throw new Error(
|
|
32
|
+
throw new Error("Failed to store media file");
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
success: true,
|
package/dist/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storeMediaFile.action.js","sourceRoot":"","sources":["../../../../../../../src/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.ts"],"names":[],"mappings":";;AAoCA,
|
|
1
|
+
{"version":3,"file":"storeMediaFile.action.js","sourceRoot":"","sources":["../../../../../../../src/mcp/primitives/essential/tools/mediaActions/actions/storeMediaFile.action.ts"],"names":[],"mappings":";;AAoCA,wCAuDC;AAvDM,KAAK,UAAU,cAAc,CAClC,MAA4B,EAC5B,MAAyB;IAEzB,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAGpE,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAGD,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;IACJ,CAAC;IAGD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAGD,MAAM,sBAAsB,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAGxD,MAAM,UAAU,GAAwB;QACtC,QAAQ;QACR,cAAc;KACf,CAAC;IAEF,IAAI,IAAI,EAAE,CAAC;QACT,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;IACzB,CAAC;SAAM,IAAI,IAAI,EAAE,CAAC;QAChB,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;IACzB,CAAC;SAAM,IAAI,GAAG,EAAE,CAAC;QACf,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC;IACvB,CAAC;IAGD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAS,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAGzE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,mCAAmC,MAAM,EAAE;QACpD,sBAAsB;KACvB,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { MediaActionsTool } from
|
|
2
|
-
export type { StoreMediaFileParams, StoreMediaFileResult, } from
|
|
3
|
-
export type { RetrieveMediaFileParams, RetrieveMediaFileResult, } from
|
|
4
|
-
export type { GetMediaFilesNamesParams, GetMediaFilesNamesResult, } from
|
|
5
|
-
export type { DeleteMediaFileParams, DeleteMediaFileResult, } from
|
|
1
|
+
export { MediaActionsTool } from "./mediaActions.tool";
|
|
2
|
+
export type { StoreMediaFileParams, StoreMediaFileResult, } from "./actions/storeMediaFile.action";
|
|
3
|
+
export type { RetrieveMediaFileParams, RetrieveMediaFileResult, } from "./actions/retrieveMediaFile.action";
|
|
4
|
+
export type { GetMediaFilesNamesParams, GetMediaFilesNamesResult, } from "./actions/getMediaFilesNames.action";
|
|
5
|
+
export type { DeleteMediaFileParams, DeleteMediaFileResult, } from "./actions/deleteMediaFile.action";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Context } from
|
|
2
|
-
import { AnkiConnectClient } from
|
|
1
|
+
import type { Context } from "@rekog/mcp-nest";
|
|
2
|
+
import { AnkiConnectClient } from "@/mcp/clients/anki-connect.client";
|
|
3
3
|
export declare class MediaActionsTool {
|
|
4
4
|
private readonly ankiClient;
|
|
5
5
|
private readonly logger;
|
|
6
6
|
constructor(ankiClient: AnkiConnectClient);
|
|
7
7
|
execute(params: {
|
|
8
|
-
action:
|
|
8
|
+
action: "storeMediaFile" | "retrieveMediaFile" | "getMediaFilesNames" | "deleteMediaFile";
|
|
9
9
|
filename?: string;
|
|
10
10
|
data?: string;
|
|
11
11
|
path?: string;
|
|
@@ -31,9 +31,9 @@ let MediaActionsTool = MediaActionsTool_1 = class MediaActionsTool {
|
|
|
31
31
|
this.logger.log(`Executing media action: ${params.action}`);
|
|
32
32
|
let result;
|
|
33
33
|
switch (params.action) {
|
|
34
|
-
case
|
|
34
|
+
case "storeMediaFile":
|
|
35
35
|
if (!params.filename) {
|
|
36
|
-
throw new Error(
|
|
36
|
+
throw new Error("filename is required for storeMediaFile action");
|
|
37
37
|
}
|
|
38
38
|
await context.reportProgress({ progress: 25, total: 100 });
|
|
39
39
|
result = await (0, storeMediaFile_action_1.storeMediaFile)({
|
|
@@ -45,30 +45,31 @@ let MediaActionsTool = MediaActionsTool_1 = class MediaActionsTool {
|
|
|
45
45
|
}, this.ankiClient);
|
|
46
46
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
47
47
|
break;
|
|
48
|
-
case
|
|
48
|
+
case "retrieveMediaFile":
|
|
49
49
|
if (!params.filename) {
|
|
50
|
-
throw new Error(
|
|
50
|
+
throw new Error("filename is required for retrieveMediaFile action");
|
|
51
51
|
}
|
|
52
52
|
await context.reportProgress({ progress: 50, total: 100 });
|
|
53
53
|
result = await (0, retrieveMediaFile_action_1.retrieveMediaFile)({ filename: params.filename }, this.ankiClient);
|
|
54
54
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
55
55
|
break;
|
|
56
|
-
case
|
|
56
|
+
case "getMediaFilesNames":
|
|
57
57
|
await context.reportProgress({ progress: 50, total: 100 });
|
|
58
58
|
result = await (0, getMediaFilesNames_action_1.getMediaFilesNames)({ pattern: params.pattern }, this.ankiClient);
|
|
59
59
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
60
60
|
break;
|
|
61
|
-
case
|
|
61
|
+
case "deleteMediaFile":
|
|
62
62
|
if (!params.filename) {
|
|
63
|
-
throw new Error(
|
|
63
|
+
throw new Error("filename is required for deleteMediaFile action");
|
|
64
64
|
}
|
|
65
65
|
await context.reportProgress({ progress: 50, total: 100 });
|
|
66
66
|
result = await (0, deleteMediaFile_action_1.deleteMediaFile)({ filename: params.filename }, this.ankiClient);
|
|
67
67
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
68
68
|
break;
|
|
69
|
-
default:
|
|
69
|
+
default: {
|
|
70
70
|
const _exhaustive = params.action;
|
|
71
71
|
throw new Error(`Unknown action: ${_exhaustive}`);
|
|
72
|
+
}
|
|
72
73
|
}
|
|
73
74
|
this.logger.log(`Successfully executed ${params.action}`);
|
|
74
75
|
return (0, anki_utils_1.createSuccessResponse)(result);
|
|
@@ -77,7 +78,7 @@ let MediaActionsTool = MediaActionsTool_1 = class MediaActionsTool {
|
|
|
77
78
|
this.logger.error(`Failed to execute ${params.action}`, error);
|
|
78
79
|
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
79
80
|
action: params.action,
|
|
80
|
-
hint:
|
|
81
|
+
hint: "Make sure Anki is running and the media file/path is valid",
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
}
|
|
@@ -85,7 +86,7 @@ let MediaActionsTool = MediaActionsTool_1 = class MediaActionsTool {
|
|
|
85
86
|
exports.MediaActionsTool = MediaActionsTool;
|
|
86
87
|
__decorate([
|
|
87
88
|
(0, mcp_nest_1.Tool)({
|
|
88
|
-
name:
|
|
89
|
+
name: "mediaActions",
|
|
89
90
|
description: `Manage Anki media files (audio/images). Supports four actions:
|
|
90
91
|
- storeMediaFile: Upload media to Anki (supports base64 data, file paths, or URLs)
|
|
91
92
|
- retrieveMediaFile: Download media from Anki as base64
|
|
@@ -95,29 +96,34 @@ __decorate([
|
|
|
95
96
|
Perfect for workflows like ElevenLabs TTS → Anki audio flashcards.`,
|
|
96
97
|
parameters: zod_1.z.object({
|
|
97
98
|
action: zod_1.z
|
|
98
|
-
.enum([
|
|
99
|
-
|
|
99
|
+
.enum([
|
|
100
|
+
"storeMediaFile",
|
|
101
|
+
"retrieveMediaFile",
|
|
102
|
+
"getMediaFilesNames",
|
|
103
|
+
"deleteMediaFile",
|
|
104
|
+
])
|
|
105
|
+
.describe("The media action to perform"),
|
|
100
106
|
filename: zod_1.z
|
|
101
107
|
.string()
|
|
102
108
|
.optional()
|
|
103
|
-
.describe(
|
|
109
|
+
.describe("Filename (required for storeMediaFile, retrieveMediaFile, deleteMediaFile)"),
|
|
104
110
|
data: zod_1.z
|
|
105
111
|
.string()
|
|
106
112
|
.optional()
|
|
107
|
-
.describe(
|
|
113
|
+
.describe("[storeMediaFile only] Base64-encoded file content"),
|
|
108
114
|
path: zod_1.z
|
|
109
115
|
.string()
|
|
110
116
|
.optional()
|
|
111
|
-
.describe(
|
|
117
|
+
.describe("[storeMediaFile only] Absolute file path"),
|
|
112
118
|
url: zod_1.z
|
|
113
119
|
.string()
|
|
114
120
|
.optional()
|
|
115
|
-
.describe(
|
|
121
|
+
.describe("[storeMediaFile only] URL to download file from"),
|
|
116
122
|
deleteExisting: zod_1.z
|
|
117
123
|
.boolean()
|
|
118
124
|
.optional()
|
|
119
125
|
.default(true)
|
|
120
|
-
.describe(
|
|
126
|
+
.describe("[storeMediaFile only] Overwrite existing file (default: true)"),
|
|
121
127
|
pattern: zod_1.z
|
|
122
128
|
.string()
|
|
123
129
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mediaActions.tool.js","sourceRoot":"","sources":["../../../../../../src/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,iFAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"mediaActions.tool.js","sourceRoot":"","sources":["../../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C;YAChE,IAAI,EAAE,OAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,0CAA0C,CAAC;YACvD,GAAG,EAAE,OAAC;iBACH,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,iDAAiD,CAAC;YAC9D,cAAc,EAAE,OAAC;iBACd,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,OAAO,CAAC,IAAI,CAAC;iBACb,QAAQ,CACP,+DAA+D,CAChE;YACH,OAAO,EAAE,OAAC;iBACP,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,0DAA0D,CAAC;SACxE,CAAC;KACH,CAAC;;;;+CAiGD;2BAtJU,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,gBAAgB,CAuJ5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from
|
|
2
|
-
import { AnkiConnectClient } from
|
|
1
|
+
import type { Context } from "@rekog/mcp-nest";
|
|
2
|
+
import { AnkiConnectClient } from "@/mcp/clients/anki-connect.client";
|
|
3
3
|
export declare class ModelFieldNamesTool {
|
|
4
4
|
private readonly ankiClient;
|
|
5
5
|
private readonly logger;
|
|
@@ -26,7 +26,7 @@ let ModelFieldNamesTool = ModelFieldNamesTool_1 = class ModelFieldNamesTool {
|
|
|
26
26
|
try {
|
|
27
27
|
this.logger.log(`Retrieving field names for model: ${modelName}`);
|
|
28
28
|
await context.reportProgress({ progress: 25, total: 100 });
|
|
29
|
-
const fieldNames = await this.ankiClient.invoke(
|
|
29
|
+
const fieldNames = await this.ankiClient.invoke("modelFieldNames", {
|
|
30
30
|
modelName: modelName,
|
|
31
31
|
});
|
|
32
32
|
await context.reportProgress({ progress: 75, total: 100 });
|
|
@@ -35,7 +35,7 @@ let ModelFieldNamesTool = ModelFieldNamesTool_1 = class ModelFieldNamesTool {
|
|
|
35
35
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
36
36
|
return (0, anki_utils_1.createErrorResponse)(new Error(`Model "${modelName}" not found`), {
|
|
37
37
|
modelName: modelName,
|
|
38
|
-
hint:
|
|
38
|
+
hint: "Use modelNames tool to see available models",
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
if (fieldNames.length === 0) {
|
|
@@ -53,22 +53,24 @@ let ModelFieldNamesTool = ModelFieldNamesTool_1 = class ModelFieldNamesTool {
|
|
|
53
53
|
this.logger.log(`Found ${fieldNames.length} fields for model ${modelName}`);
|
|
54
54
|
let exampleFields;
|
|
55
55
|
const lowerModelName = modelName.toLowerCase();
|
|
56
|
-
if (lowerModelName.includes(
|
|
56
|
+
if (lowerModelName.includes("basic") &&
|
|
57
|
+
!lowerModelName.includes("reversed")) {
|
|
57
58
|
exampleFields = {
|
|
58
|
-
Front:
|
|
59
|
-
Back:
|
|
59
|
+
Front: "Question or prompt text",
|
|
60
|
+
Back: "Answer or response text",
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
|
-
else if (lowerModelName.includes(
|
|
63
|
+
else if (lowerModelName.includes("basic") &&
|
|
64
|
+
lowerModelName.includes("reversed")) {
|
|
63
65
|
exampleFields = {
|
|
64
|
-
Front:
|
|
65
|
-
Back:
|
|
66
|
+
Front: "First side of the card",
|
|
67
|
+
Back: "Second side of the card",
|
|
66
68
|
};
|
|
67
69
|
}
|
|
68
|
-
else if (lowerModelName.includes(
|
|
70
|
+
else if (lowerModelName.includes("cloze")) {
|
|
69
71
|
exampleFields = {
|
|
70
|
-
Text:
|
|
71
|
-
Extra:
|
|
72
|
+
Text: "The {{c1::hidden}} text will be replaced with [...] on the card",
|
|
73
|
+
Extra: "Additional information or hints",
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
76
|
const response = {
|
|
@@ -76,11 +78,12 @@ let ModelFieldNamesTool = ModelFieldNamesTool_1 = class ModelFieldNamesTool {
|
|
|
76
78
|
modelName: modelName,
|
|
77
79
|
fieldNames: fieldNames,
|
|
78
80
|
total: fieldNames.length,
|
|
79
|
-
message: `Model "${modelName}" has ${fieldNames.length} field${fieldNames.length !== 1 ?
|
|
81
|
+
message: `Model "${modelName}" has ${fieldNames.length} field${fieldNames.length !== 1 ? "s" : ""}`,
|
|
80
82
|
};
|
|
81
83
|
if (exampleFields) {
|
|
82
84
|
response.example = exampleFields;
|
|
83
|
-
response.hint =
|
|
85
|
+
response.hint =
|
|
86
|
+
"Use these field names as keys when creating notes with addNote tool";
|
|
84
87
|
}
|
|
85
88
|
return (0, anki_utils_1.createSuccessResponse)(response);
|
|
86
89
|
}
|
|
@@ -88,7 +91,7 @@ let ModelFieldNamesTool = ModelFieldNamesTool_1 = class ModelFieldNamesTool {
|
|
|
88
91
|
this.logger.error(`Failed to retrieve field names for model ${modelName}`, error);
|
|
89
92
|
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
90
93
|
modelName: modelName,
|
|
91
|
-
hint:
|
|
94
|
+
hint: "Make sure the model name is correct and Anki is running",
|
|
92
95
|
});
|
|
93
96
|
}
|
|
94
97
|
}
|
|
@@ -96,13 +99,13 @@ let ModelFieldNamesTool = ModelFieldNamesTool_1 = class ModelFieldNamesTool {
|
|
|
96
99
|
exports.ModelFieldNamesTool = ModelFieldNamesTool;
|
|
97
100
|
__decorate([
|
|
98
101
|
(0, mcp_nest_1.Tool)({
|
|
99
|
-
name:
|
|
100
|
-
description:
|
|
102
|
+
name: "modelFieldNames",
|
|
103
|
+
description: "Get the field names for a specific note type (model). Use this to know what fields are required when creating notes of this type.",
|
|
101
104
|
parameters: zod_1.z.object({
|
|
102
105
|
modelName: zod_1.z
|
|
103
106
|
.string()
|
|
104
107
|
.min(1)
|
|
105
|
-
.describe(
|
|
108
|
+
.describe("The name of the model/note type to get fields for"),
|
|
106
109
|
}),
|
|
107
110
|
}),
|
|
108
111
|
__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-field-names.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/essential/tools/model-field-names.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"model-field-names.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/essential/tools/model-field-names.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;IAaxD,AAAN,KAAK,CAAC,eAAe,CACnB,EAAE,SAAS,EAAyB,EACpC,OAAgB;QAEhB,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,SAAS,EAAE,CAAC,CAAC;YAClE,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAG3D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAC7C,iBAAiB,EACjB;gBACE,SAAS,EAAE,SAAS;aACrB,CACF,CAAC;YAEF,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAE3D,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAC;gBAClD,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;gBAC5D,OAAO,IAAA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C;;;;0DAoGD;8BAnHU,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,mBAAmB,CAoH/B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Context } from
|
|
2
|
-
import { AnkiConnectClient } from
|
|
1
|
+
import type { Context } from "@rekog/mcp-nest";
|
|
2
|
+
import { AnkiConnectClient } from "@/mcp/clients/anki-connect.client";
|
|
3
3
|
export declare class ModelNamesTool {
|
|
4
4
|
private readonly ankiClient;
|
|
5
5
|
private readonly logger;
|
|
6
6
|
constructor(ankiClient: AnkiConnectClient);
|
|
7
|
-
modelNames(_args:
|
|
7
|
+
modelNames(_args: Record<string, never>, context: Context): Promise<{
|
|
8
8
|
[x: string]: unknown;
|
|
9
9
|
content: ({
|
|
10
10
|
[x: string]: unknown;
|
|
@@ -24,16 +24,16 @@ let ModelNamesTool = ModelNamesTool_1 = class ModelNamesTool {
|
|
|
24
24
|
}
|
|
25
25
|
async modelNames(_args, context) {
|
|
26
26
|
try {
|
|
27
|
-
this.logger.log(
|
|
27
|
+
this.logger.log("Retrieving model names from Anki");
|
|
28
28
|
await context.reportProgress({ progress: 25, total: 100 });
|
|
29
|
-
const modelNames = await this.ankiClient.invoke(
|
|
29
|
+
const modelNames = await this.ankiClient.invoke("modelNames");
|
|
30
30
|
await context.reportProgress({ progress: 75, total: 100 });
|
|
31
31
|
if (!modelNames || modelNames.length === 0) {
|
|
32
|
-
this.logger.log(
|
|
32
|
+
this.logger.log("No models found");
|
|
33
33
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
34
34
|
return (0, anki_utils_1.createSuccessResponse)({
|
|
35
35
|
success: true,
|
|
36
|
-
message:
|
|
36
|
+
message: "No note types found in Anki",
|
|
37
37
|
modelNames: [],
|
|
38
38
|
total: 0,
|
|
39
39
|
});
|
|
@@ -46,16 +46,18 @@ let ModelNamesTool = ModelNamesTool_1 = class ModelNamesTool {
|
|
|
46
46
|
total: modelNames.length,
|
|
47
47
|
message: `Found ${modelNames.length} note types`,
|
|
48
48
|
commonTypes: {
|
|
49
|
-
basic: modelNames.includes(
|
|
50
|
-
basicReversed: modelNames.includes(
|
|
51
|
-
|
|
49
|
+
basic: modelNames.includes("Basic") ? "Basic" : null,
|
|
50
|
+
basicReversed: modelNames.includes("Basic (and reversed card)")
|
|
51
|
+
? "Basic (and reversed card)"
|
|
52
|
+
: null,
|
|
53
|
+
cloze: modelNames.includes("Cloze") ? "Cloze" : null,
|
|
52
54
|
},
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
catch (error) {
|
|
56
|
-
this.logger.error(
|
|
58
|
+
this.logger.error("Failed to retrieve model names", error);
|
|
57
59
|
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
58
|
-
hint:
|
|
60
|
+
hint: "Make sure Anki is running and AnkiConnect is installed",
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -63,8 +65,8 @@ let ModelNamesTool = ModelNamesTool_1 = class ModelNamesTool {
|
|
|
63
65
|
exports.ModelNamesTool = ModelNamesTool;
|
|
64
66
|
__decorate([
|
|
65
67
|
(0, mcp_nest_1.Tool)({
|
|
66
|
-
name:
|
|
67
|
-
description:
|
|
68
|
+
name: "modelNames",
|
|
69
|
+
description: "Get a list of all available note type (model) names in Anki. Use this to see what note types are available before creating notes.",
|
|
68
70
|
parameters: zod_1.z.object({}),
|
|
69
71
|
}),
|
|
70
72
|
__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-names.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/essential/tools/model-names.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"model-names.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/essential/tools/model-names.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;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CAAC,SAAS,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC;YAErD,OAAO,IAAA,kCAAqB,EAAC;gBAC3B,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,UAAU;gBACtB,KAAK,EAAE,UAAU,CAAC,MAAM;gBACxB,OAAO,EAAE,SAAS,UAAU,CAAC,MAAM,aAAa;gBAChD,WAAW,EAAE;oBACX,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;oBACpD,aAAa,EAAE,UAAU,CAAC,QAAQ,CAAC,2BAA2B,CAAC;wBAC7D,CAAC,CAAC,2BAA2B;wBAC7B,CAAC,CAAC,IAAI;oBACR,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;iBACrD;aACF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YAC3D,OAAO,IAAA,gCAAmB,EAAC,KAAK,EAAE;gBAChC,IAAI,EAAE,wDAAwD;aAC/D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAA;AAvDY,wCAAc;AAWnB;IANL,IAAA,eAAI,EAAC;QACJ,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,mIAAmI;QACrI,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KACzB,CAAC;;;;gDA4CD;yBAtDU,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,cAAc,CAuD1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from
|
|
2
|
-
import { AnkiConnectClient } from
|
|
1
|
+
import type { Context } from "@rekog/mcp-nest";
|
|
2
|
+
import { AnkiConnectClient } from "@/mcp/clients/anki-connect.client";
|
|
3
3
|
export declare class ModelStylingTool {
|
|
4
4
|
private readonly ankiClient;
|
|
5
5
|
private readonly logger;
|
|
@@ -26,7 +26,7 @@ let ModelStylingTool = ModelStylingTool_1 = class ModelStylingTool {
|
|
|
26
26
|
try {
|
|
27
27
|
this.logger.log(`Retrieving CSS styling for model: ${modelName}`);
|
|
28
28
|
await context.reportProgress({ progress: 25, total: 100 });
|
|
29
|
-
const styling = await this.ankiClient.invoke(
|
|
29
|
+
const styling = await this.ankiClient.invoke("modelStyling", {
|
|
30
30
|
modelName: modelName,
|
|
31
31
|
});
|
|
32
32
|
await context.reportProgress({ progress: 75, total: 100 });
|
|
@@ -35,16 +35,16 @@ let ModelStylingTool = ModelStylingTool_1 = class ModelStylingTool {
|
|
|
35
35
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
36
36
|
return (0, anki_utils_1.createErrorResponse)(new Error(`Model "${modelName}" not found or has no styling`), {
|
|
37
37
|
modelName: modelName,
|
|
38
|
-
hint:
|
|
38
|
+
hint: "Use modelNames tool to see available models",
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
await context.reportProgress({ progress: 100, total: 100 });
|
|
42
42
|
const css = styling.css;
|
|
43
43
|
const cssLength = css.length;
|
|
44
|
-
const hasCardClass = css.includes(
|
|
45
|
-
const hasFrontClass = css.includes(
|
|
46
|
-
const hasBackClass = css.includes(
|
|
47
|
-
const hasClozeClass = css.includes(
|
|
44
|
+
const hasCardClass = css.includes(".card");
|
|
45
|
+
const hasFrontClass = css.includes(".front");
|
|
46
|
+
const hasBackClass = css.includes(".back");
|
|
47
|
+
const hasClozeClass = css.includes(".cloze");
|
|
48
48
|
this.logger.log(`Retrieved CSS styling for model ${modelName} (${cssLength} chars)`);
|
|
49
49
|
return (0, anki_utils_1.createSuccessResponse)({
|
|
50
50
|
success: true,
|
|
@@ -58,14 +58,14 @@ let ModelStylingTool = ModelStylingTool_1 = class ModelStylingTool {
|
|
|
58
58
|
hasClozeStyling: hasClozeClass,
|
|
59
59
|
},
|
|
60
60
|
message: `Retrieved CSS styling for model "${modelName}"`,
|
|
61
|
-
hint:
|
|
61
|
+
hint: "This CSS is automatically applied when cards of this type are rendered in Anki",
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
65
65
|
this.logger.error(`Failed to retrieve styling for model ${modelName}`, error);
|
|
66
66
|
return (0, anki_utils_1.createErrorResponse)(error, {
|
|
67
67
|
modelName: modelName,
|
|
68
|
-
hint:
|
|
68
|
+
hint: "Make sure the model name is correct and Anki is running",
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -73,13 +73,13 @@ let ModelStylingTool = ModelStylingTool_1 = class ModelStylingTool {
|
|
|
73
73
|
exports.ModelStylingTool = ModelStylingTool;
|
|
74
74
|
__decorate([
|
|
75
75
|
(0, mcp_nest_1.Tool)({
|
|
76
|
-
name:
|
|
77
|
-
description:
|
|
76
|
+
name: "modelStyling",
|
|
77
|
+
description: "Get the CSS styling for a specific note type (model). This CSS is used when rendering cards of this type.",
|
|
78
78
|
parameters: zod_1.z.object({
|
|
79
79
|
modelName: zod_1.z
|
|
80
80
|
.string()
|
|
81
81
|
.min(1)
|
|
82
|
-
.describe(
|
|
82
|
+
.describe("The name of the model/note type to get styling for"),
|
|
83
83
|
}),
|
|
84
84
|
}),
|
|
85
85
|
__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-styling.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/essential/tools/model-styling.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAAwB;AACxB,8EAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"model-styling.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/essential/tools/model-styling.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AAEvC,6BAA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E,OAAC;iBACT,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,oDAAoD,CAAC;SAClE,CAAC;KACH,CAAC;;;;oDAkED;2BAjFU,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,gBAAgB,CAkF5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from
|
|
2
|
-
import { AnkiConnectClient } from
|
|
1
|
+
import type { Context } from "@rekog/mcp-nest";
|
|
2
|
+
import { AnkiConnectClient } from "@/mcp/clients/anki-connect.client";
|
|
3
3
|
export declare class NotesInfoTool {
|
|
4
4
|
private readonly ankiClient;
|
|
5
5
|
private readonly logger;
|