modality-kit 0.12.1 → 0.12.3

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.js CHANGED
@@ -31,51 +31,6 @@ var setupAITools = (aiTools, mcpServer) => {
31
31
  }
32
32
  return aiTools;
33
33
  };
34
- // src/util_response.ts
35
- function formatSuccessResponse(content, meta) {
36
- const { instructions, ...restContent } = content;
37
- return JSON.stringify({
38
- success: true,
39
- instructions,
40
- content: restContent,
41
- meta
42
- });
43
- }
44
- function formatErrorResponse(errorData, operation, meta) {
45
- let errorResponse;
46
- if (typeof errorData === "string") {
47
- errorResponse = {
48
- success: false,
49
- error: errorData,
50
- operation,
51
- meta
52
- };
53
- } else if (errorData instanceof Error) {
54
- errorResponse = {
55
- success: false,
56
- error: errorData.message,
57
- operation,
58
- meta
59
- };
60
- } else if (typeof errorData === "object" && errorData !== null && typeof errorData.message === "string") {
61
- const errObj = errorData;
62
- errorResponse = {
63
- success: errObj.success || false,
64
- error: errObj.message,
65
- code: errObj.code,
66
- operation: errObj.operation || operation,
67
- meta
68
- };
69
- } else {
70
- errorResponse = {
71
- success: false,
72
- error: "Unknown error",
73
- operation,
74
- meta
75
- };
76
- }
77
- return JSON.stringify(errorResponse);
78
- }
79
34
  // src/util_logger.ts
80
35
  var levels = [null, "debug", "info", "warn", "error", "success"];
81
36
 
@@ -230,6 +185,7 @@ class ModalityLogger {
230
185
  }
231
186
  }
232
187
  var getLoggerInstance = ModalityLogger.getInstance.bind(ModalityLogger);
188
+
233
189
  // src/util_error.ts
234
190
  var logger = getLoggerInstance("Safe to Handle");
235
191
 
@@ -263,6 +219,61 @@ function withErrorHandling(fn, operation) {
263
219
  }
264
220
  };
265
221
  }
222
+
223
+ // src/util_response.ts
224
+ function formatSuccessResponse(content, meta) {
225
+ const { instructions, ...restContent } = content;
226
+ return JSON.stringify({
227
+ success: true,
228
+ instructions,
229
+ content: restContent,
230
+ meta
231
+ });
232
+ }
233
+ function formatErrorResponse(errorData, operation, meta) {
234
+ let errorResponse;
235
+ if (typeof errorData === "string") {
236
+ errorResponse = {
237
+ success: false,
238
+ error: errorData,
239
+ operation,
240
+ meta
241
+ };
242
+ } else if (errorData instanceof ErrorCode) {
243
+ errorResponse = {
244
+ success: false,
245
+ error: errorData.message,
246
+ code: errorData.code,
247
+ reason: errorData.cause?.message,
248
+ operation,
249
+ meta
250
+ };
251
+ } else if (errorData instanceof Error) {
252
+ errorResponse = {
253
+ success: false,
254
+ error: errorData.message,
255
+ operation,
256
+ meta
257
+ };
258
+ } else if (typeof errorData === "object" && errorData !== null && typeof errorData.message === "string") {
259
+ const errObj = errorData;
260
+ errorResponse = {
261
+ success: errObj.success || false,
262
+ error: errObj.message,
263
+ code: errObj.code,
264
+ operation: errObj.operation || operation,
265
+ meta
266
+ };
267
+ } else {
268
+ errorResponse = {
269
+ success: false,
270
+ error: "Unknown error",
271
+ operation,
272
+ meta
273
+ };
274
+ }
275
+ return JSON.stringify(errorResponse);
276
+ }
266
277
  // src/schemas/schemas_symbol.ts
267
278
  var exports_schemas_symbol = {};
268
279
  __export(exports_schemas_symbol, {
@@ -14,6 +14,7 @@ export interface McpErrorResponse {
14
14
  error: string;
15
15
  code?: string;
16
16
  operation?: string;
17
+ reason?: string;
17
18
  meta?: Record<string, any>;
18
19
  }
19
20
  interface SuccessData {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.12.1",
2
+ "version": "0.12.3",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",