anki-mcp-http 0.19.2 → 0.20.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.
Files changed (25) hide show
  1. package/README.md +7 -1
  2. package/dist/mcp/clients/anki-connect.client.js +5 -0
  3. package/dist/mcp/clients/anki-connect.client.js.map +1 -1
  4. package/dist/mcp/primitives/essential/index.d.ts +13 -1
  5. package/dist/mcp/primitives/essential/index.js +25 -1
  6. package/dist/mcp/primitives/essential/index.js.map +1 -1
  7. package/dist/mcp/primitives/essential/tools/add-model-field.tool.d.ts +113 -0
  8. package/dist/mcp/primitives/essential/tools/add-model-field.tool.js +150 -0
  9. package/dist/mcp/primitives/essential/tools/add-model-field.tool.js.map +1 -0
  10. package/dist/mcp/primitives/essential/tools/model-templates.tool.d.ts +116 -0
  11. package/dist/mcp/primitives/essential/tools/model-templates.tool.js +95 -0
  12. package/dist/mcp/primitives/essential/tools/model-templates.tool.js.map +1 -0
  13. package/dist/mcp/primitives/essential/tools/remove-model-field.tool.d.ts +112 -0
  14. package/dist/mcp/primitives/essential/tools/remove-model-field.tool.js +107 -0
  15. package/dist/mcp/primitives/essential/tools/remove-model-field.tool.js.map +1 -0
  16. package/dist/mcp/primitives/essential/tools/rename-model-field.tool.d.ts +114 -0
  17. package/dist/mcp/primitives/essential/tools/rename-model-field.tool.js +156 -0
  18. package/dist/mcp/primitives/essential/tools/rename-model-field.tool.js.map +1 -0
  19. package/dist/mcp/primitives/essential/tools/reposition-model-field.tool.d.ts +113 -0
  20. package/dist/mcp/primitives/essential/tools/reposition-model-field.tool.js +137 -0
  21. package/dist/mcp/primitives/essential/tools/reposition-model-field.tool.js.map +1 -0
  22. package/dist/mcp/primitives/essential/tools/update-model-templates.tool.d.ts +115 -0
  23. package/dist/mcp/primitives/essential/tools/update-model-templates.tool.js +140 -0
  24. package/dist/mcp/primitives/essential/tools/update-model-templates.tool.js.map +1 -0
  25. package/package.json +11 -11
package/README.md CHANGED
@@ -84,8 +84,14 @@ Just tell Claude where the image is, and it will handle the upload automatically
84
84
  - `modelNames` - List all available note types/models
85
85
  - `modelFieldNames` - Get field names for a specific note type
86
86
  - `modelStyling` - Get CSS styling information for a note type
87
+ - `modelTemplates` - Get the card templates (Front and Back HTML) for a note type
87
88
  - `createModel` - Create a new note type with custom fields, card templates, and CSS (e.g., RTL models)
88
89
  - `updateModelStyling` - Update the CSS styling for an existing note type (applies to all its cards)
90
+ - `updateModelTemplates` - Update the card templates (Front and Back HTML) for an existing note type (applies to all its cards)
91
+ - `addModelField` - Add a new field to an existing note type (appended at the end or inserted at a specific position)
92
+ - `removeModelField` - Remove a field from an existing note type (deletes its content from all notes; requires explicit confirmation)
93
+ - `renameModelField` - Rename a field in an existing note type (card templates referencing the old name must be updated separately)
94
+ - `repositionModelField` - Change the position of a field within an existing note type
89
95
 
90
96
  #### Statistics
91
97
  - `collection_stats` - Aggregated statistics across all decks with per-deck breakdown
@@ -902,7 +908,7 @@ This project follows [Semantic Versioning](https://semver.org/) with a pre-1.0 d
902
908
  - Will be released when the API is stable and tested
903
909
  - Breaking changes will require major version bumps (2.0.0, etc.)
904
910
 
905
- **Current Status**: `0.19.0` - Active beta development. Recent features include batch note creation (`addNotes`), integrated ngrok tunneling (`--ngrok` flag), media file management, model/template management, and comprehensive deck statistics. APIs may change based on feedback and testing.
911
+ **Current Status**: `0.20.0` - Active beta development. Recent features include model field management (`addModelField`, `removeModelField`, `renameModelField`, `repositionModelField`), batch note creation (`addNotes`), integrated ngrok tunneling (`--ngrok` flag), media file management, model/template management, and comprehensive deck statistics. APIs may change based on feedback and testing.
906
912
 
907
913
  ### MCPB spec evolution
908
914
 
@@ -64,6 +64,11 @@ const WRITE_ACTIONS = new Set([
64
64
  "deleteMediaFile",
65
65
  "createModel",
66
66
  "updateModelStyling",
67
+ "updateModelTemplates",
68
+ "modelFieldAdd",
69
+ "modelFieldRemove",
70
+ "modelFieldRename",
71
+ "modelFieldReposition",
67
72
  ]);
68
73
  class AnkiConnectError extends Error {
69
74
  action;
@@ -1 +1 @@
1
- {"version":3,"file":"anki-connect.client.js","sourceRoot":"","sources":["../../../src/mcp/clients/anki-connect.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,yCAA+C;AAC/C,2EAA8D;AAW9D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAE5B,SAAS;IACT,kBAAkB;IAClB,aAAa;IAEb,YAAY;IACZ,YAAY;IAEZ,SAAS;IACT,YAAY;IACZ,iBAAiB;IACjB,aAAa;IAEb,gBAAgB;IAChB,iBAAiB;IAEjB,aAAa;IACb,oBAAoB;CACrB,CAAC,CAAC;AAKH,MAAa,gBAAiB,SAAQ,KAAK;IAGvB;IACA;IAHlB,YACE,OAAe,EACC,MAAe,EACf,aAAsB;QAEtC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,WAAM,GAAN,MAAM,CAAS;QACf,kBAAa,GAAb,aAAa,CAAS;QAGtC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AATD,4CASC;AAKD,MAAa,iBAAkB,SAAQ,KAAK;IACd;IAA5B,YAA4B,MAAc;QACxC,KAAK,CACH,WAAW,MAAM,qDAAqD;YACpE,8EAA8E,CACjF,CAAC;QAJwB,WAAM,GAAN,MAAM,CAAQ;QAKxC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AARD,8CAQC;AAMM,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAOsB;IANjC,MAAM,CAAa;IACnB,UAAU,CAAS;IACnB,MAAM,CAAU;IAChB,QAAQ,CAAU;IAClB,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAE7D,YAAkD,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;QACnE,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC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,kCAAkC,MAAM,EAAE,CAAC,CAAC;YAC5D,OAAO,QAAQ,CAAC,MAAM,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEf,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;gBACvC,MAAM,KAAK,CAAC;YACd,CAAC;YAGD,IAAI,KAAK,YAAY,cAAS,EAAE,CAAC;gBAC/B,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAClC,MAAM,IAAI,gBAAgB,CACxB,wEAAwE,EACxE,MAAM,CACP,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,gBAAgB,CACxB,cAAc,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,OAAO,EAAE,EACvD,MAAM,CACP,CAAC;YACJ,CAAC;YAGD,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC9D,MAAM,IAAI,gBAAgB,CACxB,4FAA4F,EAC5F,MAAM,CACP,CAAC;YACJ,CAAC;YAGD,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;gBACtC,MAAM,KAAK,CAAC;YACd,CAAC;YAGD,MAAM,IAAI,gBAAgB,CACxB,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAC7E,MAAM,CACP,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AApIY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAQE,WAAA,IAAA,eAAM,EAAC,mCAAW,CAAC,CAAA;;GAPrB,iBAAiB,CAoI7B"}
@@ -13,6 +13,12 @@ export { ModelFieldNamesTool } from "./tools/model-field-names.tool";
13
13
  export { ModelStylingTool } from "./tools/model-styling.tool";
14
14
  export { CreateModelTool } from "./tools/create-model.tool";
15
15
  export { UpdateModelStylingTool } from "./tools/update-model-styling.tool";
16
+ export { ModelTemplatesTool } from "./tools/model-templates.tool";
17
+ export { UpdateModelTemplatesTool } from "./tools/update-model-templates.tool";
18
+ export { AddModelFieldTool } from "./tools/add-model-field.tool";
19
+ export { RemoveModelFieldTool } from "./tools/remove-model-field.tool";
20
+ export { RenameModelFieldTool } from "./tools/rename-model-field.tool";
21
+ export { RepositionModelFieldTool } from "./tools/reposition-model-field.tool";
16
22
  export { AddNoteTool } from "./tools/add-note.tool";
17
23
  export { AddNotesTool } from "./tools/add-notes.tool";
18
24
  export { FindNotesTool } from "./tools/find-notes.tool";
@@ -48,6 +54,12 @@ import { ModelFieldNamesTool } from "./tools/model-field-names.tool";
48
54
  import { ModelStylingTool } from "./tools/model-styling.tool";
49
55
  import { CreateModelTool } from "./tools/create-model.tool";
50
56
  import { UpdateModelStylingTool } from "./tools/update-model-styling.tool";
57
+ import { ModelTemplatesTool } from "./tools/model-templates.tool";
58
+ import { UpdateModelTemplatesTool } from "./tools/update-model-templates.tool";
59
+ import { AddModelFieldTool } from "./tools/add-model-field.tool";
60
+ import { RemoveModelFieldTool } from "./tools/remove-model-field.tool";
61
+ import { RenameModelFieldTool } from "./tools/rename-model-field.tool";
62
+ import { RepositionModelFieldTool } from "./tools/reposition-model-field.tool";
51
63
  import { AddNoteTool } from "./tools/add-note.tool";
52
64
  import { AddNotesTool } from "./tools/add-notes.tool";
53
65
  import { FindNotesTool } from "./tools/find-notes.tool";
@@ -72,7 +84,7 @@ import { ReviewStatsTool } from "./tools/review-stats";
72
84
  import { ReviewSessionPrompt } from "./prompts/review-session.prompt";
73
85
  import { TwentyRulesPrompt } from "./prompts/twenty-rules.prompt";
74
86
  import { SystemInfoResource } from "./resources/system-info.resource";
75
- export declare const ESSENTIAL_MCP_TOOLS: (typeof SyncTool | typeof GetDueCardsTool | typeof GetCardsTool | typeof PresentCardTool | typeof RateCardTool | typeof ModelNamesTool | typeof ModelFieldNamesTool | typeof ModelStylingTool | typeof CreateModelTool | typeof UpdateModelStylingTool | typeof AddNoteTool | typeof AddNotesTool | typeof FindNotesTool | typeof NotesInfoTool | typeof UpdateNoteFieldsTool | typeof DeleteNotesTool | typeof GetTagsTool | typeof ListDecksTool | typeof DeckStatsTool | typeof CreateDeckTool | typeof ChangeDeckTool | typeof RetrieveMediaFileTool | typeof GetMediaFilesNamesTool | typeof StoreMediaFileTool | typeof DeleteMediaFileTool | typeof AddTagsTool | typeof RemoveTagsTool | typeof ReplaceTagsTool | typeof ClearUnusedTagsTool | typeof CollectionStatsTool | typeof ReviewStatsTool | typeof ReviewSessionPrompt | typeof TwentyRulesPrompt | typeof SystemInfoResource)[];
87
+ export declare const ESSENTIAL_MCP_TOOLS: (typeof SyncTool | typeof GetDueCardsTool | typeof GetCardsTool | typeof PresentCardTool | typeof RateCardTool | typeof ModelNamesTool | typeof ModelFieldNamesTool | typeof ModelStylingTool | typeof CreateModelTool | typeof UpdateModelStylingTool | typeof ModelTemplatesTool | typeof UpdateModelTemplatesTool | typeof AddModelFieldTool | typeof RemoveModelFieldTool | typeof RenameModelFieldTool | typeof RepositionModelFieldTool | typeof AddNoteTool | typeof AddNotesTool | typeof FindNotesTool | typeof NotesInfoTool | typeof UpdateNoteFieldsTool | typeof DeleteNotesTool | typeof GetTagsTool | typeof ListDecksTool | typeof DeckStatsTool | typeof CreateDeckTool | typeof ChangeDeckTool | typeof RetrieveMediaFileTool | typeof GetMediaFilesNamesTool | typeof StoreMediaFileTool | typeof DeleteMediaFileTool | typeof AddTagsTool | typeof RemoveTagsTool | typeof ReplaceTagsTool | typeof ClearUnusedTagsTool | typeof CollectionStatsTool | typeof ReviewStatsTool | typeof ReviewSessionPrompt | typeof TwentyRulesPrompt | typeof SystemInfoResource)[];
76
88
  export interface McpPrimitivesAnkiEssentialModuleOptions {
77
89
  ankiConfigProvider: Provider;
78
90
  appConfigProvider?: Provider;
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
21
  };
22
22
  var McpPrimitivesAnkiEssentialModule_1;
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.McpPrimitivesAnkiEssentialModule = exports.ESSENTIAL_MCP_TOOLS = exports.SystemInfoResource = exports.TwentyRulesPrompt = exports.ReviewSessionPrompt = exports.ReviewStatsTool = exports.CollectionStatsTool = exports.ClearUnusedTagsTool = exports.ReplaceTagsTool = exports.RemoveTagsTool = exports.AddTagsTool = exports.DeleteMediaFileTool = exports.StoreMediaFileTool = exports.GetMediaFilesNamesTool = exports.RetrieveMediaFileTool = exports.ChangeDeckTool = exports.CreateDeckTool = exports.DeckStatsTool = exports.ListDecksTool = exports.GetTagsTool = exports.DeleteNotesTool = exports.UpdateNoteFieldsTool = exports.NotesInfoTool = exports.FindNotesTool = exports.AddNotesTool = exports.AddNoteTool = exports.UpdateModelStylingTool = exports.CreateModelTool = exports.ModelStylingTool = exports.ModelFieldNamesTool = exports.ModelNamesTool = exports.RateCardTool = exports.PresentCardTool = exports.GetCardsTool = exports.GetDueCardsTool = exports.SyncTool = exports.ReadOnlyModeError = exports.AnkiConnectError = exports.AnkiConnectClient = exports.ANKI_CONFIG = void 0;
24
+ exports.McpPrimitivesAnkiEssentialModule = exports.ESSENTIAL_MCP_TOOLS = exports.SystemInfoResource = exports.TwentyRulesPrompt = exports.ReviewSessionPrompt = exports.ReviewStatsTool = exports.CollectionStatsTool = exports.ClearUnusedTagsTool = exports.ReplaceTagsTool = exports.RemoveTagsTool = exports.AddTagsTool = exports.DeleteMediaFileTool = exports.StoreMediaFileTool = exports.GetMediaFilesNamesTool = exports.RetrieveMediaFileTool = exports.ChangeDeckTool = exports.CreateDeckTool = exports.DeckStatsTool = exports.ListDecksTool = exports.GetTagsTool = exports.DeleteNotesTool = exports.UpdateNoteFieldsTool = exports.NotesInfoTool = exports.FindNotesTool = exports.AddNotesTool = exports.AddNoteTool = exports.RepositionModelFieldTool = exports.RenameModelFieldTool = exports.RemoveModelFieldTool = exports.AddModelFieldTool = exports.UpdateModelTemplatesTool = exports.ModelTemplatesTool = exports.UpdateModelStylingTool = exports.CreateModelTool = exports.ModelStylingTool = exports.ModelFieldNamesTool = exports.ModelNamesTool = exports.RateCardTool = exports.PresentCardTool = exports.GetCardsTool = exports.GetDueCardsTool = exports.SyncTool = exports.ReadOnlyModeError = exports.AnkiConnectError = exports.AnkiConnectClient = exports.ANKI_CONFIG = void 0;
25
25
  var anki_config_interface_1 = require("../../config/anki-config.interface");
26
26
  Object.defineProperty(exports, "ANKI_CONFIG", { enumerable: true, get: function () { return anki_config_interface_1.ANKI_CONFIG; } });
27
27
  __exportStar(require("../../types/anki.types"), exports);
@@ -50,6 +50,18 @@ var create_model_tool_1 = require("./tools/create-model.tool");
50
50
  Object.defineProperty(exports, "CreateModelTool", { enumerable: true, get: function () { return create_model_tool_1.CreateModelTool; } });
51
51
  var update_model_styling_tool_1 = require("./tools/update-model-styling.tool");
52
52
  Object.defineProperty(exports, "UpdateModelStylingTool", { enumerable: true, get: function () { return update_model_styling_tool_1.UpdateModelStylingTool; } });
53
+ var model_templates_tool_1 = require("./tools/model-templates.tool");
54
+ Object.defineProperty(exports, "ModelTemplatesTool", { enumerable: true, get: function () { return model_templates_tool_1.ModelTemplatesTool; } });
55
+ var update_model_templates_tool_1 = require("./tools/update-model-templates.tool");
56
+ Object.defineProperty(exports, "UpdateModelTemplatesTool", { enumerable: true, get: function () { return update_model_templates_tool_1.UpdateModelTemplatesTool; } });
57
+ var add_model_field_tool_1 = require("./tools/add-model-field.tool");
58
+ Object.defineProperty(exports, "AddModelFieldTool", { enumerable: true, get: function () { return add_model_field_tool_1.AddModelFieldTool; } });
59
+ var remove_model_field_tool_1 = require("./tools/remove-model-field.tool");
60
+ Object.defineProperty(exports, "RemoveModelFieldTool", { enumerable: true, get: function () { return remove_model_field_tool_1.RemoveModelFieldTool; } });
61
+ var rename_model_field_tool_1 = require("./tools/rename-model-field.tool");
62
+ Object.defineProperty(exports, "RenameModelFieldTool", { enumerable: true, get: function () { return rename_model_field_tool_1.RenameModelFieldTool; } });
63
+ var reposition_model_field_tool_1 = require("./tools/reposition-model-field.tool");
64
+ Object.defineProperty(exports, "RepositionModelFieldTool", { enumerable: true, get: function () { return reposition_model_field_tool_1.RepositionModelFieldTool; } });
53
65
  var add_note_tool_1 = require("./tools/add-note.tool");
54
66
  Object.defineProperty(exports, "AddNoteTool", { enumerable: true, get: function () { return add_note_tool_1.AddNoteTool; } });
55
67
  var add_notes_tool_1 = require("./tools/add-notes.tool");
@@ -110,6 +122,12 @@ const model_field_names_tool_2 = require("./tools/model-field-names.tool");
110
122
  const model_styling_tool_2 = require("./tools/model-styling.tool");
111
123
  const create_model_tool_2 = require("./tools/create-model.tool");
112
124
  const update_model_styling_tool_2 = require("./tools/update-model-styling.tool");
125
+ const model_templates_tool_2 = require("./tools/model-templates.tool");
126
+ const update_model_templates_tool_2 = require("./tools/update-model-templates.tool");
127
+ const add_model_field_tool_2 = require("./tools/add-model-field.tool");
128
+ const remove_model_field_tool_2 = require("./tools/remove-model-field.tool");
129
+ const rename_model_field_tool_2 = require("./tools/rename-model-field.tool");
130
+ const reposition_model_field_tool_2 = require("./tools/reposition-model-field.tool");
113
131
  const add_note_tool_2 = require("./tools/add-note.tool");
114
132
  const add_notes_tool_2 = require("./tools/add-notes.tool");
115
133
  const find_notes_tool_2 = require("./tools/find-notes.tool");
@@ -145,6 +163,12 @@ exports.ESSENTIAL_MCP_TOOLS = [
145
163
  model_styling_tool_2.ModelStylingTool,
146
164
  create_model_tool_2.CreateModelTool,
147
165
  update_model_styling_tool_2.UpdateModelStylingTool,
166
+ model_templates_tool_2.ModelTemplatesTool,
167
+ update_model_templates_tool_2.UpdateModelTemplatesTool,
168
+ add_model_field_tool_2.AddModelFieldTool,
169
+ remove_model_field_tool_2.RemoveModelFieldTool,
170
+ rename_model_field_tool_2.RenameModelFieldTool,
171
+ reposition_model_field_tool_2.RepositionModelFieldTool,
148
172
  add_note_tool_2.AddNoteTool,
149
173
  add_notes_tool_2.AddNotesTool,
150
174
  find_notes_tool_2.FindNotesTool,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp/primitives/essential/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAiE;AAAxD,oHAAA,WAAW,OAAA;AAIpB,yDAAuC;AAGvC,yDAAuC;AAGvC,yEAI2C;AAHzC,wHAAA,iBAAiB,OAAA;AACjB,uHAAA,gBAAgB,OAAA;AAChB,wHAAA,iBAAiB,OAAA;AAInB,+CAA6C;AAApC,qGAAA,QAAQ,OAAA;AACjB,iEAA6D;AAApD,qHAAA,eAAe,OAAA;AACxB,yDAAsD;AAA7C,8GAAA,YAAY,OAAA;AACrB,+DAA4D;AAAnD,oHAAA,eAAe,OAAA;AACxB,yDAAsD;AAA7C,8GAAA,YAAY,OAAA;AACrB,6DAA0D;AAAjD,kHAAA,cAAc,OAAA;AACvB,yEAAqE;AAA5D,6HAAA,mBAAmB,OAAA;AAC5B,iEAA8D;AAArD,sHAAA,gBAAgB,OAAA;AACzB,+DAA4D;AAAnD,oHAAA,eAAe,OAAA;AACxB,+EAA2E;AAAlE,mIAAA,sBAAsB,OAAA;AAC/B,uDAAoD;AAA3C,4GAAA,WAAW,OAAA;AACpB,yDAAsD;AAA7C,8GAAA,YAAY,OAAA;AACrB,2DAAwD;AAA/C,gHAAA,aAAa,OAAA;AACtB,2DAAwD;AAA/C,gHAAA,aAAa,OAAA;AACtB,2EAAuE;AAA9D,+HAAA,oBAAoB,OAAA;AAC7B,+DAA4D;AAAnD,oHAAA,eAAe,OAAA;AACxB,uDAAoD;AAA3C,4GAAA,WAAW,OAAA;AAEpB,2DAAwD;AAA/C,gHAAA,aAAa,OAAA;AACtB,2DAAwD;AAA/C,gHAAA,aAAa,OAAA;AACtB,6DAA0D;AAAjD,kHAAA,cAAc,OAAA;AACvB,6DAA0D;AAAjD,kHAAA,cAAc,OAAA;AAEvB,6E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mCAAe;IACf,kDAAsB;IACtB,2BAAW;IACX,6BAAY;IACZ,+BAAa;IACb,+BAAa;IACb,8CAAoB;IACpB,mCAAe;IACf,2BAAW;IAEX,+BAAa;IACb,+BAAa;IACb,iCAAc;IACd,iCAAc;IAEd,gDAAqB;IACrB,mDAAsB;IACtB,0CAAkB;IAClB,4CAAmB;IAEnB,2BAAW;IACX,iCAAc;IACd,mCAAe;IACf,4CAAmB;IACnB,sCAAmB;IACnB,8BAAe;IAEf,2CAAmB;IACnB,uCAAiB;IAEjB,yCAAkB;CACnB,CAAC;AAGF,MAAM,wBAAwB,GAAG,CAAC,uCAAiB,EAAE,GAAG,2BAAmB,CAAC,CAAC;AAStE,IAAM,gCAAgC,wCAAtC,MAAM,gCAAgC;IAC3C,MAAM,CAAC,OAAO,CACZ,OAAgD;QAEhD,MAAM,SAAS,GAAe;YAC5B,OAAO,CAAC,kBAAkB;YAC1B,GAAG,wBAAwB;SAC5B,CAAC;QAGF,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAC9B,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO;YACL,MAAM,EAAE,kCAAgC;YACxC,SAAS;YACT,OAAO,EAAE,wBAAwB;SAClC,CAAC;IACJ,CAAC;CACF,CAAA;AApBY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,gCAAgC,CAoB5C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp/primitives/essential/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAiE;AAAxD,oHAAA,WAAW,OAAA;AAIpB,yDAAuC;AAGvC,yDAAuC;AAGvC,yEAI2C;AAHzC,wHAAA,iBAAiB,OAAA;AACjB,uHAAA,gBAAgB,OAAA;AAChB,wHAAA,iBAAiB,OAAA;AAInB,+CAA6C;AAApC,qGAAA,QAAQ,OA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IAClB,sDAAwB;IACxB,wCAAiB;IACjB,8CAAoB;IACpB,8CAAoB;IACpB,sDAAwB;IACxB,2BAAW;IACX,6BAAY;IACZ,+BAAa;IACb,+BAAa;IACb,8CAAoB;IACpB,mCAAe;IACf,2BAAW;IAEX,+BAAa;IACb,+BAAa;IACb,iCAAc;IACd,iCAAc;IAEd,gDAAqB;IACrB,mDAAsB;IACtB,0CAAkB;IAClB,4CAAmB;IAEnB,2BAAW;IACX,iCAAc;IACd,mCAAe;IACf,4CAAmB;IACnB,sCAAmB;IACnB,8BAAe;IAEf,2CAAmB;IACnB,uCAAiB;IAEjB,yCAAkB;CACnB,CAAC;AAGF,MAAM,wBAAwB,GAAG,CAAC,uCAAiB,EAAE,GAAG,2BAAmB,CAAC,CAAC;AAStE,IAAM,gCAAgC,wCAAtC,MAAM,gCAAgC;IAC3C,MAAM,CAAC,OAAO,CACZ,OAAgD;QAEhD,MAAM,SAAS,GAAe;YAC5B,OAAO,CAAC,kBAAkB;YAC1B,GAAG,wBAAwB;SAC5B,CAAC;QAGF,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAC9B,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO;YACL,MAAM,EAAE,kCAAgC;YACxC,SAAS;YACT,OAAO,EAAE,wBAAwB;SAClC,CAAC;IACJ,CAAC;CACF,CAAA;AApBY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,gCAAgC,CAoB5C"}
@@ -0,0 +1,113 @@
1
+ import { AnkiConnectClient } from "../../../clients/anki-connect.client";
2
+ export declare class AddModelFieldTool {
3
+ private readonly ankiClient;
4
+ private readonly logger;
5
+ constructor(ankiClient: AnkiConnectClient);
6
+ addModelField({ modelName, fieldName, index, }: {
7
+ modelName: string;
8
+ fieldName: string;
9
+ index?: number;
10
+ }): Promise<{
11
+ [x: string]: unknown;
12
+ content: ({
13
+ type: "text";
14
+ text: string;
15
+ annotations?: {
16
+ audience?: ("user" | "assistant")[] | undefined;
17
+ priority?: number | undefined;
18
+ lastModified?: string | undefined;
19
+ } | undefined;
20
+ _meta?: {
21
+ [x: string]: unknown;
22
+ } | undefined;
23
+ } | {
24
+ type: "image";
25
+ data: string;
26
+ mimeType: string;
27
+ annotations?: {
28
+ audience?: ("user" | "assistant")[] | undefined;
29
+ priority?: number | undefined;
30
+ lastModified?: string | undefined;
31
+ } | undefined;
32
+ _meta?: {
33
+ [x: string]: unknown;
34
+ } | undefined;
35
+ } | {
36
+ type: "audio";
37
+ data: string;
38
+ mimeType: string;
39
+ annotations?: {
40
+ audience?: ("user" | "assistant")[] | undefined;
41
+ priority?: number | undefined;
42
+ lastModified?: string | undefined;
43
+ } | undefined;
44
+ _meta?: {
45
+ [x: string]: unknown;
46
+ } | undefined;
47
+ } | {
48
+ uri: string;
49
+ name: string;
50
+ type: "resource_link";
51
+ description?: string | undefined;
52
+ mimeType?: string | undefined;
53
+ size?: number | undefined;
54
+ annotations?: {
55
+ audience?: ("user" | "assistant")[] | undefined;
56
+ priority?: number | undefined;
57
+ lastModified?: string | undefined;
58
+ } | undefined;
59
+ _meta?: {
60
+ [x: string]: unknown;
61
+ } | undefined;
62
+ icons?: {
63
+ src: string;
64
+ mimeType?: string | undefined;
65
+ sizes?: string[] | undefined;
66
+ theme?: "light" | "dark" | undefined;
67
+ }[] | undefined;
68
+ title?: string | undefined;
69
+ } | {
70
+ type: "resource";
71
+ resource: {
72
+ uri: string;
73
+ text: string;
74
+ mimeType?: string | undefined;
75
+ _meta?: {
76
+ [x: string]: unknown;
77
+ } | undefined;
78
+ } | {
79
+ uri: string;
80
+ blob: string;
81
+ mimeType?: string | undefined;
82
+ _meta?: {
83
+ [x: string]: unknown;
84
+ } | undefined;
85
+ };
86
+ annotations?: {
87
+ audience?: ("user" | "assistant")[] | undefined;
88
+ priority?: number | undefined;
89
+ lastModified?: string | undefined;
90
+ } | undefined;
91
+ _meta?: {
92
+ [x: string]: unknown;
93
+ } | undefined;
94
+ })[];
95
+ _meta?: {
96
+ [x: string]: unknown;
97
+ progressToken?: string | number | undefined;
98
+ "io.modelcontextprotocol/related-task"?: {
99
+ taskId: string;
100
+ } | undefined;
101
+ } | undefined;
102
+ structuredContent?: {
103
+ [x: string]: unknown;
104
+ } | undefined;
105
+ isError?: boolean | undefined;
106
+ } | {
107
+ success: boolean;
108
+ modelName: string;
109
+ fieldName: string;
110
+ index: number | null;
111
+ message: string;
112
+ }>;
113
+ }
@@ -0,0 +1,150 @@
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 AddModelFieldTool_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AddModelFieldTool = 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 AddModelFieldTool = AddModelFieldTool_1 = class AddModelFieldTool {
20
+ ankiClient;
21
+ logger = new common_1.Logger(AddModelFieldTool_1.name);
22
+ constructor(ankiClient) {
23
+ this.ankiClient = ankiClient;
24
+ }
25
+ async addModelField({ modelName, fieldName, index, }) {
26
+ try {
27
+ this.logger.log(`Adding field "${fieldName}" to model "${modelName}"${index !== undefined ? ` at index ${index}` : ""}`);
28
+ const fields = await this.ankiClient.invoke("modelFieldNames", {
29
+ modelName,
30
+ });
31
+ if (!fields || fields.length === 0) {
32
+ return (0, anki_utils_1.createErrorResponse)(new Error(`Model "${modelName}" has no fields or does not exist`), {
33
+ modelName,
34
+ fieldName,
35
+ hint: "Model not found. Use modelNames tool to see available models.",
36
+ });
37
+ }
38
+ if (fields.includes(fieldName)) {
39
+ return (0, anki_utils_1.createErrorResponse)(new Error(`Field "${fieldName}" already exists in model "${modelName}". ` +
40
+ "AnkiConnect would silently skip the add instead of erroring " +
41
+ "(and reposition the existing field if an index is given)."), {
42
+ modelName,
43
+ fieldName,
44
+ hint: `Field "${fieldName}" already exists. Use modelFieldNames to see existing fields.`,
45
+ });
46
+ }
47
+ const caseVariant = fields.find((f) => f.toLowerCase() === fieldName.toLowerCase());
48
+ if (caseVariant) {
49
+ return (0, anki_utils_1.createErrorResponse)(new Error(`Field "${fieldName}" collides with existing field "${caseVariant}" ` +
50
+ `in model "${modelName}" (names differ only in case)`), {
51
+ modelName,
52
+ fieldName,
53
+ hint: `Field names are case-sensitive, but "${fieldName}" differs from existing field "${caseVariant}" only in case. Pick a distinct name.`,
54
+ });
55
+ }
56
+ if (index !== undefined && (index < 0 || index > fields.length)) {
57
+ return (0, anki_utils_1.createErrorResponse)(new Error(`Index ${index} is out of range for model "${modelName}". ` +
58
+ `Valid range is 0-${fields.length} (${fields.length} appends at the end). ` +
59
+ "AnkiConnect would silently clamp the index instead of erroring."), {
60
+ modelName,
61
+ fieldName,
62
+ index,
63
+ hint: "Use modelFieldNames to see how many fields exist.",
64
+ });
65
+ }
66
+ const params = {
67
+ modelName,
68
+ fieldName,
69
+ };
70
+ if (index !== undefined) {
71
+ params.index = index;
72
+ }
73
+ await this.ankiClient.invoke("modelFieldAdd", params);
74
+ this.logger.log(`Successfully added field "${fieldName}" to model "${modelName}"`);
75
+ return {
76
+ success: true,
77
+ modelName,
78
+ fieldName,
79
+ index: index ?? null,
80
+ message: index !== undefined
81
+ ? `Successfully added field "${fieldName}" to model "${modelName}" at position ${index}`
82
+ : `Successfully added field "${fieldName}" to model "${modelName}"`,
83
+ };
84
+ }
85
+ catch (error) {
86
+ this.logger.error(`Failed to add field "${fieldName}" to model "${modelName}"`, error);
87
+ const errorMessage = error instanceof Error ? error.message : String(error);
88
+ if (errorMessage.includes("not found") ||
89
+ errorMessage.includes("does not exist")) {
90
+ return (0, anki_utils_1.createErrorResponse)(error, {
91
+ modelName,
92
+ fieldName,
93
+ hint: "Model not found. Use modelNames tool to see available models.",
94
+ });
95
+ }
96
+ return (0, anki_utils_1.createErrorResponse)(error, {
97
+ modelName,
98
+ fieldName,
99
+ hint: "Make sure Anki is running and the model name is correct.",
100
+ });
101
+ }
102
+ }
103
+ };
104
+ exports.AddModelFieldTool = AddModelFieldTool;
105
+ __decorate([
106
+ (0, mcp_nest_1.Tool)({
107
+ name: "addModelField",
108
+ description: "Add a new field to an existing Anki note type (model). " +
109
+ "The field is appended to the end by default, or inserted at a specific position. " +
110
+ "Existing notes of this type will have the new field set to empty. " +
111
+ "Use modelFieldNames to see current fields before adding.",
112
+ parameters: zod_1.z.object({
113
+ modelName: zod_1.z
114
+ .string()
115
+ .min(1)
116
+ .describe('Name of the note type to modify (e.g., "Basic", "Latin Vocabulary")'),
117
+ fieldName: zod_1.z
118
+ .string()
119
+ .min(1)
120
+ .describe('Name of the new field to add (e.g., "Grammar", "IPA", "Example")'),
121
+ index: zod_1.z
122
+ .number()
123
+ .int()
124
+ .min(0)
125
+ .optional()
126
+ .describe("Position to insert the field (0-based). Omit to append at the end."),
127
+ }),
128
+ outputSchema: zod_1.z.object({
129
+ success: zod_1.z.boolean(),
130
+ modelName: zod_1.z.string(),
131
+ fieldName: zod_1.z.string(),
132
+ index: zod_1.z.number().nullable(),
133
+ message: zod_1.z.string(),
134
+ }),
135
+ annotations: {
136
+ title: "Add Field to Note Type",
137
+ readOnlyHint: false,
138
+ destructiveHint: false,
139
+ idempotentHint: false,
140
+ },
141
+ }),
142
+ __metadata("design:type", Function),
143
+ __metadata("design:paramtypes", [Object]),
144
+ __metadata("design:returntype", Promise)
145
+ ], AddModelFieldTool.prototype, "addModelField", null);
146
+ exports.AddModelFieldTool = AddModelFieldTool = AddModelFieldTool_1 = __decorate([
147
+ (0, common_1.Injectable)(),
148
+ __metadata("design:paramtypes", [anki_connect_client_1.AnkiConnectClient])
149
+ ], AddModelFieldTool);
150
+ //# sourceMappingURL=add-model-field.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-model-field.tool.js","sourceRoot":"","sources":["../../../../../src/mcp/primitives/essential/tools/add-model-field.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAAuC;AACvC,6BAAwB;AACxB,8EAAsE;AACtE,0DAA6D;AAMtD,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;IA6CxD,AAAN,KAAK,CAAC,aAAa,CAAC,EAClB,SAAS,EACT,SAAS,EACT,KAAK,GAKN;QACC,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,iBAAiB,SAAS,eAAe,SAAS,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACxG,CAAC;YAOF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAW,iBAAiB,EAAE;gBACvE,SAAS;aACV,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnC,OAAO,IAAA,gCAAmB,EACxB,IAAI,KAAK,CAAC,UAAU,SA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,EAAE,eAAe;QACrB,WAAW,EACT,yDAAyD;YACzD,mFAAmF;YACnF,oEAAoE;YACpE,0DAA0D;QAC5D,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;YACnB,SAAS,EAAE,OAAC;iBACT,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,qEAAqE,CACtE;YACH,SAAS,EAAE,OAAC;iBACT,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,kEAAkE,CACnE;YACH,KAAK,EAAE,OAAC;iBACL,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,EAAE;iBACV,QAAQ,CACP,oEAAoE,CACrE;SACJ,CAAC;QACF,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC;YACrB,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;YACpB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;YACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;YACrB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC5B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;SACpB,CAAC;QACF,WAAW,EAAE;YACX,KAAK,EAAE,wBAAwB;YAC/B,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,KAAK;SACtB;KACF,CAAC;;;;sDAuID;4BAtLU,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAI8B,uCAAiB;GAH/C,iBAAiB,CAuL7B"}
@@ -0,0 +1,116 @@
1
+ import { AnkiConnectClient } from "../../../clients/anki-connect.client";
2
+ export declare class ModelTemplatesTool {
3
+ private readonly ankiClient;
4
+ private readonly logger;
5
+ constructor(ankiClient: AnkiConnectClient);
6
+ modelTemplates({ modelName }: {
7
+ modelName: string;
8
+ }): Promise<{
9
+ [x: string]: unknown;
10
+ content: ({
11
+ type: "text";
12
+ text: string;
13
+ annotations?: {
14
+ audience?: ("user" | "assistant")[] | undefined;
15
+ priority?: number | undefined;
16
+ lastModified?: string | undefined;
17
+ } | undefined;
18
+ _meta?: {
19
+ [x: string]: unknown;
20
+ } | undefined;
21
+ } | {
22
+ type: "image";
23
+ data: string;
24
+ mimeType: string;
25
+ annotations?: {
26
+ audience?: ("user" | "assistant")[] | undefined;
27
+ priority?: number | undefined;
28
+ lastModified?: string | undefined;
29
+ } | undefined;
30
+ _meta?: {
31
+ [x: string]: unknown;
32
+ } | undefined;
33
+ } | {
34
+ type: "audio";
35
+ data: string;
36
+ mimeType: string;
37
+ annotations?: {
38
+ audience?: ("user" | "assistant")[] | undefined;
39
+ priority?: number | undefined;
40
+ lastModified?: string | undefined;
41
+ } | undefined;
42
+ _meta?: {
43
+ [x: string]: unknown;
44
+ } | undefined;
45
+ } | {
46
+ uri: string;
47
+ name: string;
48
+ type: "resource_link";
49
+ description?: string | undefined;
50
+ mimeType?: string | undefined;
51
+ size?: number | undefined;
52
+ annotations?: {
53
+ audience?: ("user" | "assistant")[] | undefined;
54
+ priority?: number | undefined;
55
+ lastModified?: string | undefined;
56
+ } | undefined;
57
+ _meta?: {
58
+ [x: string]: unknown;
59
+ } | undefined;
60
+ icons?: {
61
+ src: string;
62
+ mimeType?: string | undefined;
63
+ sizes?: string[] | undefined;
64
+ theme?: "light" | "dark" | undefined;
65
+ }[] | undefined;
66
+ title?: string | undefined;
67
+ } | {
68
+ type: "resource";
69
+ resource: {
70
+ uri: string;
71
+ text: string;
72
+ mimeType?: string | undefined;
73
+ _meta?: {
74
+ [x: string]: unknown;
75
+ } | undefined;
76
+ } | {
77
+ uri: string;
78
+ blob: string;
79
+ mimeType?: string | undefined;
80
+ _meta?: {
81
+ [x: string]: unknown;
82
+ } | undefined;
83
+ };
84
+ annotations?: {
85
+ audience?: ("user" | "assistant")[] | undefined;
86
+ priority?: number | undefined;
87
+ lastModified?: string | undefined;
88
+ } | undefined;
89
+ _meta?: {
90
+ [x: string]: unknown;
91
+ } | undefined;
92
+ })[];
93
+ _meta?: {
94
+ [x: string]: unknown;
95
+ progressToken?: string | number | undefined;
96
+ "io.modelcontextprotocol/related-task"?: {
97
+ taskId: string;
98
+ } | undefined;
99
+ } | undefined;
100
+ structuredContent?: {
101
+ [x: string]: unknown;
102
+ } | undefined;
103
+ isError?: boolean | undefined;
104
+ } | {
105
+ success: boolean;
106
+ modelName: string;
107
+ templates: {
108
+ [cardName: string]: {
109
+ Front: string;
110
+ Back: string;
111
+ };
112
+ };
113
+ message: string;
114
+ hint: string;
115
+ }>;
116
+ }