@vue-skuilder/mcp 0.1.14-2 → 0.1.15

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/dist/index.d.cts CHANGED
@@ -44,17 +44,29 @@ interface CardResource {
44
44
  declare const CreateCardInputMCPSchema: {
45
45
  datashape: z.ZodString;
46
46
  data: z.ZodAny;
47
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
48
48
  elo: z.ZodOptional<z.ZodNumber>;
49
49
  sourceRef: z.ZodOptional<z.ZodString>;
50
50
  };
51
51
  declare const CreateCardInputSchema: z.ZodObject<{
52
52
  datashape: z.ZodString;
53
53
  data: z.ZodAny;
54
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
54
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
55
55
  elo: z.ZodOptional<z.ZodNumber>;
56
56
  sourceRef: z.ZodOptional<z.ZodString>;
57
- }, z.core.$strip>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ datashape: string;
59
+ elo?: number | undefined;
60
+ tags?: string[] | undefined;
61
+ data?: any;
62
+ sourceRef?: string | undefined;
63
+ }, {
64
+ datashape: string;
65
+ elo?: number | undefined;
66
+ tags?: string[] | undefined;
67
+ data?: any;
68
+ sourceRef?: string | undefined;
69
+ }>;
58
70
  type CreateCardInput = z.infer<typeof CreateCardInputSchema>;
59
71
  interface CreateCardOutput {
60
72
  cardId: string;
@@ -64,17 +76,29 @@ interface CreateCardOutput {
64
76
  declare const UpdateCardInputMCPSchema: {
65
77
  cardId: z.ZodString;
66
78
  data: z.ZodOptional<z.ZodAny>;
67
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
68
80
  elo: z.ZodOptional<z.ZodNumber>;
69
81
  sourceRef: z.ZodOptional<z.ZodString>;
70
82
  };
71
83
  declare const UpdateCardInputSchema: z.ZodObject<{
72
84
  cardId: z.ZodString;
73
85
  data: z.ZodOptional<z.ZodAny>;
74
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
75
87
  elo: z.ZodOptional<z.ZodNumber>;
76
88
  sourceRef: z.ZodOptional<z.ZodString>;
77
- }, z.core.$strip>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ cardId: string;
91
+ elo?: number | undefined;
92
+ tags?: string[] | undefined;
93
+ data?: any;
94
+ sourceRef?: string | undefined;
95
+ }, {
96
+ cardId: string;
97
+ elo?: number | undefined;
98
+ tags?: string[] | undefined;
99
+ data?: any;
100
+ sourceRef?: string | undefined;
101
+ }>;
78
102
  type UpdateCardInput = z.infer<typeof UpdateCardInputSchema>;
79
103
  interface UpdateCardOutput {
80
104
  cardId: string;
@@ -88,22 +112,26 @@ interface UpdateCardOutput {
88
112
  }
89
113
  declare const TagCardInputMCPSchema: {
90
114
  cardId: z.ZodString;
91
- action: z.ZodEnum<{
92
- add: "add";
93
- remove: "remove";
94
- }>;
95
- tags: z.ZodArray<z.ZodString>;
115
+ action: z.ZodEnum<["add", "remove"]>;
116
+ tags: z.ZodArray<z.ZodString, "many">;
96
117
  updateELO: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
97
118
  };
98
119
  declare const TagCardInputSchema: z.ZodObject<{
99
120
  cardId: z.ZodString;
100
- action: z.ZodEnum<{
101
- add: "add";
102
- remove: "remove";
103
- }>;
104
- tags: z.ZodArray<z.ZodString>;
121
+ action: z.ZodEnum<["add", "remove"]>;
122
+ tags: z.ZodArray<z.ZodString, "many">;
105
123
  updateELO: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
106
- }, z.core.$strip>;
124
+ }, "strip", z.ZodTypeAny, {
125
+ cardId: string;
126
+ tags: string[];
127
+ action: "add" | "remove";
128
+ updateELO: boolean;
129
+ }, {
130
+ cardId: string;
131
+ tags: string[];
132
+ action: "add" | "remove";
133
+ updateELO?: boolean | undefined;
134
+ }>;
107
135
  type TagCardInput = z.infer<typeof TagCardInputSchema>;
108
136
  interface TagCardOutput {
109
137
  cardId: string;
@@ -121,7 +149,15 @@ declare const DeleteCardInputSchema: z.ZodObject<{
121
149
  cardId: z.ZodString;
122
150
  confirm: z.ZodDefault<z.ZodBoolean>;
123
151
  reason: z.ZodOptional<z.ZodString>;
124
- }, z.core.$strip>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ cardId: string;
154
+ confirm: boolean;
155
+ reason?: string | undefined;
156
+ }, {
157
+ cardId: string;
158
+ confirm?: boolean | undefined;
159
+ reason?: string | undefined;
160
+ }>;
125
161
  type DeleteCardInput = z.infer<typeof DeleteCardInputSchema>;
126
162
  interface DeleteCardOutput {
127
163
  cardId: string;
package/dist/index.d.ts CHANGED
@@ -44,17 +44,29 @@ interface CardResource {
44
44
  declare const CreateCardInputMCPSchema: {
45
45
  datashape: z.ZodString;
46
46
  data: z.ZodAny;
47
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
48
48
  elo: z.ZodOptional<z.ZodNumber>;
49
49
  sourceRef: z.ZodOptional<z.ZodString>;
50
50
  };
51
51
  declare const CreateCardInputSchema: z.ZodObject<{
52
52
  datashape: z.ZodString;
53
53
  data: z.ZodAny;
54
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
54
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
55
55
  elo: z.ZodOptional<z.ZodNumber>;
56
56
  sourceRef: z.ZodOptional<z.ZodString>;
57
- }, z.core.$strip>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ datashape: string;
59
+ elo?: number | undefined;
60
+ tags?: string[] | undefined;
61
+ data?: any;
62
+ sourceRef?: string | undefined;
63
+ }, {
64
+ datashape: string;
65
+ elo?: number | undefined;
66
+ tags?: string[] | undefined;
67
+ data?: any;
68
+ sourceRef?: string | undefined;
69
+ }>;
58
70
  type CreateCardInput = z.infer<typeof CreateCardInputSchema>;
59
71
  interface CreateCardOutput {
60
72
  cardId: string;
@@ -64,17 +76,29 @@ interface CreateCardOutput {
64
76
  declare const UpdateCardInputMCPSchema: {
65
77
  cardId: z.ZodString;
66
78
  data: z.ZodOptional<z.ZodAny>;
67
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
68
80
  elo: z.ZodOptional<z.ZodNumber>;
69
81
  sourceRef: z.ZodOptional<z.ZodString>;
70
82
  };
71
83
  declare const UpdateCardInputSchema: z.ZodObject<{
72
84
  cardId: z.ZodString;
73
85
  data: z.ZodOptional<z.ZodAny>;
74
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
75
87
  elo: z.ZodOptional<z.ZodNumber>;
76
88
  sourceRef: z.ZodOptional<z.ZodString>;
77
- }, z.core.$strip>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ cardId: string;
91
+ elo?: number | undefined;
92
+ tags?: string[] | undefined;
93
+ data?: any;
94
+ sourceRef?: string | undefined;
95
+ }, {
96
+ cardId: string;
97
+ elo?: number | undefined;
98
+ tags?: string[] | undefined;
99
+ data?: any;
100
+ sourceRef?: string | undefined;
101
+ }>;
78
102
  type UpdateCardInput = z.infer<typeof UpdateCardInputSchema>;
79
103
  interface UpdateCardOutput {
80
104
  cardId: string;
@@ -88,22 +112,26 @@ interface UpdateCardOutput {
88
112
  }
89
113
  declare const TagCardInputMCPSchema: {
90
114
  cardId: z.ZodString;
91
- action: z.ZodEnum<{
92
- add: "add";
93
- remove: "remove";
94
- }>;
95
- tags: z.ZodArray<z.ZodString>;
115
+ action: z.ZodEnum<["add", "remove"]>;
116
+ tags: z.ZodArray<z.ZodString, "many">;
96
117
  updateELO: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
97
118
  };
98
119
  declare const TagCardInputSchema: z.ZodObject<{
99
120
  cardId: z.ZodString;
100
- action: z.ZodEnum<{
101
- add: "add";
102
- remove: "remove";
103
- }>;
104
- tags: z.ZodArray<z.ZodString>;
121
+ action: z.ZodEnum<["add", "remove"]>;
122
+ tags: z.ZodArray<z.ZodString, "many">;
105
123
  updateELO: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
106
- }, z.core.$strip>;
124
+ }, "strip", z.ZodTypeAny, {
125
+ cardId: string;
126
+ tags: string[];
127
+ action: "add" | "remove";
128
+ updateELO: boolean;
129
+ }, {
130
+ cardId: string;
131
+ tags: string[];
132
+ action: "add" | "remove";
133
+ updateELO?: boolean | undefined;
134
+ }>;
107
135
  type TagCardInput = z.infer<typeof TagCardInputSchema>;
108
136
  interface TagCardOutput {
109
137
  cardId: string;
@@ -121,7 +149,15 @@ declare const DeleteCardInputSchema: z.ZodObject<{
121
149
  cardId: z.ZodString;
122
150
  confirm: z.ZodDefault<z.ZodBoolean>;
123
151
  reason: z.ZodOptional<z.ZodString>;
124
- }, z.core.$strip>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ cardId: string;
154
+ confirm: boolean;
155
+ reason?: string | undefined;
156
+ }, {
157
+ cardId: string;
158
+ confirm?: boolean | undefined;
159
+ reason?: string | undefined;
160
+ }>;
125
161
  type DeleteCardInput = z.infer<typeof DeleteCardInputSchema>;
126
162
  interface DeleteCardOutput {
127
163
  cardId: string;
package/dist/index.js CHANGED
@@ -319,8 +319,8 @@ async function handleCardsEloResource(courseDB, eloRange, limit = 50, offset = 0
319
319
  // src/resources/shapes.ts
320
320
  async function handleShapesAllResource(_courseDB) {
321
321
  try {
322
- const { getAllDataShapesRaw: getAllDataShapesRaw2 } = await import("@vue-skuilder/courseware/backend");
323
- const dataShapes = getAllDataShapesRaw2();
322
+ const { getAllDataShapesRaw } = await import("@vue-skuilder/courseware/backend");
323
+ const dataShapes = getAllDataShapesRaw();
324
324
  const shapes = dataShapes.map((shape) => ({
325
325
  name: shape.name,
326
326
  description: `DataShape for ${shape.name} content type`,
@@ -349,8 +349,8 @@ async function handleShapesAllResource(_courseDB) {
349
349
  }
350
350
  async function handleShapeSpecificResource(courseDB, shapeName) {
351
351
  try {
352
- const { getAllDataShapesRaw: getAllDataShapesRaw2 } = await import("@vue-skuilder/courseware/backend");
353
- const dataShapes = getAllDataShapesRaw2();
352
+ const { getAllDataShapesRaw } = await import("@vue-skuilder/courseware/backend");
353
+ const dataShapes = getAllDataShapesRaw();
354
354
  const targetShape = dataShapes.find((shape) => shape.name === shapeName);
355
355
  if (!targetShape) {
356
356
  const availableShapes = dataShapes.map((s) => s.name);
@@ -571,8 +571,8 @@ async function handleTagsDistributionResource(courseDB) {
571
571
 
572
572
  // src/resources/schema.ts
573
573
  async function handleSchemaResource(_courseDB, dataShapeName) {
574
- const { getAllDataShapesRaw: getAllDataShapesRaw2 } = await import("@vue-skuilder/courseware/backend");
575
- const dataShapes = getAllDataShapesRaw2();
574
+ const { getAllDataShapesRaw } = await import("@vue-skuilder/courseware/backend");
575
+ const dataShapes = getAllDataShapesRaw();
576
576
  const dataShape = dataShapes.find((ds) => ds.name === dataShapeName);
577
577
  if (!dataShape) {
578
578
  return {
@@ -661,11 +661,55 @@ var DeleteCardInputSchema = import_zod4.z.object(DeleteCardInputMCPSchema);
661
661
 
662
662
  // src/tools/create-card.ts
663
663
  var import_common = require("@vue-skuilder/common");
664
- var import_backend = require("@vue-skuilder/courseware/backend");
664
+ function reconstructDataShapeFromConfig(dataShapeName, serializedSchema) {
665
+ const jsonSchema = JSON.parse(serializedSchema);
666
+ const fields = [];
667
+ if (jsonSchema.properties) {
668
+ for (const [fieldName, fieldSchema] of Object.entries(jsonSchema.properties)) {
669
+ const schema = fieldSchema;
670
+ let fieldType = import_common.FieldType.STRING;
671
+ if (schema.type === "string") {
672
+ if (schema.contentEncoding === "base64" || fieldName.toLowerCase().includes("image")) {
673
+ fieldType = import_common.FieldType.IMAGE;
674
+ } else if (fieldName.toLowerCase().includes("audio")) {
675
+ fieldType = import_common.FieldType.AUDIO;
676
+ } else if (schema.description?.includes("Markdown") || schema.description?.includes("markdown")) {
677
+ fieldType = import_common.FieldType.MARKDOWN;
678
+ } else {
679
+ fieldType = import_common.FieldType.STRING;
680
+ }
681
+ } else if (schema.type === "number") {
682
+ fieldType = import_common.FieldType.NUMBER;
683
+ } else if (schema.type === "integer") {
684
+ fieldType = import_common.FieldType.INT;
685
+ } else if (schema.type === "array") {
686
+ if (fieldName === "Uploads" || fieldName.toLowerCase().includes("upload")) {
687
+ fieldType = import_common.FieldType.MEDIA_UPLOADS;
688
+ }
689
+ }
690
+ fields.push({
691
+ name: fieldName,
692
+ type: fieldType
693
+ });
694
+ }
695
+ }
696
+ return {
697
+ name: dataShapeName,
698
+ // Cast to DataShapeName - it's just a string at runtime
699
+ fields
700
+ };
701
+ }
665
702
  async function handleCreateCard(courseDB, input) {
666
703
  const TOOL_NAME = "create_card";
667
704
  try {
668
705
  const validatedInput = CreateCardInputSchema.parse(input);
706
+ if (typeof validatedInput.data === "string") {
707
+ try {
708
+ validatedInput.data = JSON.parse(validatedInput.data);
709
+ } catch (e) {
710
+ throw new Error(`Invalid JSON in data parameter: ${e instanceof Error ? e.message : String(e)}`);
711
+ }
712
+ }
669
713
  logToolStart(TOOL_NAME, validatedInput);
670
714
  const courseConfig = await courseDB.getCourseConfig();
671
715
  const availableDataShapes = courseConfig.dataShapes.map((ds) => ds.name);
@@ -690,17 +734,14 @@ async function handleCreateCard(courseDB, input) {
690
734
  logToolWarning(TOOL_NAME, errorMsg);
691
735
  throw new Error(errorMsg);
692
736
  }
693
- const runtimeDataShape = (0, import_backend.getAllDataShapesRaw)().find((ds) => ds.name === shapeDescriptor.dataShape);
694
- if (!runtimeDataShape) {
695
- const errorMsg = `Runtime DataShape not found in courseware: ${shapeDescriptor.dataShape}`;
696
- logToolWarning(TOOL_NAME, errorMsg);
697
- throw new Error(errorMsg);
698
- }
737
+ const dataShape = reconstructDataShapeFromConfig(
738
+ shapeDescriptor.dataShape,
739
+ matchingDataShape.serializedZodSchema
740
+ );
699
741
  logToolStart(
700
742
  TOOL_NAME,
701
- `Using runtime DataShape with ${runtimeDataShape.fields.length} fields`
743
+ `Using DataShape with ${dataShape.fields.length} fields (reconstructed from course config)`
702
744
  );
703
- const dataShape = runtimeDataShape;
704
745
  const result = await courseDB.addNote(
705
746
  shapeDescriptor.course,
706
747
  // Use courseware name, not courseID