modality-kit 0.14.11 → 0.14.12

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
@@ -36,18 +36,8 @@ var ContentType = [
36
36
  "resource_link",
37
37
  "resource"
38
38
  ];
39
- function formatSuccessResponse(successData, content) {
40
- const data = structuredClone(successData);
39
+ function mergeResponsesContent(result, content) {
41
40
  const contentData = content ? structuredClone(content) : null;
42
- const result = {
43
- isError: false,
44
- content: [
45
- {
46
- type: "text",
47
- text: JSON.stringify(data)
48
- }
49
- ]
50
- };
51
41
  if (Array.isArray(contentData)) {
52
42
  result.content.push(...contentData.map((item) => {
53
43
  if (typeof item === "string") {
@@ -66,6 +56,19 @@ function formatSuccessResponse(successData, content) {
66
56
  }
67
57
  return result;
68
58
  }
59
+ function formatSuccessResponse(successData, content) {
60
+ const data = structuredClone(successData);
61
+ const result = {
62
+ isError: false,
63
+ content: [
64
+ {
65
+ type: "text",
66
+ text: JSON.stringify(data)
67
+ }
68
+ ]
69
+ };
70
+ return mergeResponsesContent(result, content);
71
+ }
69
72
  function formatErrorResponse(errorData, operation, meta) {
70
73
  let errorResponse;
71
74
  let isError = true;
@@ -6016,6 +6019,7 @@ class SimpleCache {
6016
6019
  }
6017
6020
  export {
6018
6021
  withErrorHandling,
6022
+ mergeResponsesContent,
6019
6023
  loadVersion,
6020
6024
  isTestEnvironment,
6021
6025
  getLoggerInstance,
@@ -1,4 +1,4 @@
1
- export { formatErrorResponse, formatSuccessResponse } from "./util_response";
1
+ export { formatErrorResponse, formatSuccessResponse, mergeResponsesContent } from "./util_response";
2
2
  export { getLoggerInstance, type ModalityLogger } from "./util_logger";
3
3
  export { withErrorHandling } from "./util_error";
4
4
  export { ErrorCode } from "./ErrorCode";
@@ -25,6 +25,7 @@ interface ErrorData extends Record<string, any> {
25
25
  message: string;
26
26
  operation?: string;
27
27
  }
28
+ export declare function mergeResponsesContent(result: CallToolResult, content: any): CallToolResult;
28
29
  export declare function formatSuccessResponse(successData: SuccessData, content?: any): CallToolResult;
29
30
  /**
30
31
  * Format an error response for MCP tools using generic error data
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.14.11",
2
+ "version": "0.14.12",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",