modality-kit 0.14.12 → 0.14.14

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,10 +36,11 @@ var ContentType = [
36
36
  "resource_link",
37
37
  "resource"
38
38
  ];
39
- function mergeResponsesContent(result, content) {
39
+ function mergeResponsesContent(content) {
40
40
  const contentData = content ? structuredClone(content) : null;
41
+ const contentBlock = new Array;
41
42
  if (Array.isArray(contentData)) {
42
- result.content.push(...contentData.map((item) => {
43
+ contentBlock.push(...contentData.map((item) => {
43
44
  if (typeof item === "string") {
44
45
  return { type: "text", text: item };
45
46
  } else if (item.type && ContentType.includes(item.type)) {
@@ -49,12 +50,12 @@ function mergeResponsesContent(result, content) {
49
50
  }
50
51
  }));
51
52
  } else if (contentData != null) {
52
- result.content.push({
53
+ contentBlock.push({
53
54
  type: "text",
54
55
  text: typeof contentData === "string" ? contentData : JSON.stringify(contentData)
55
56
  });
56
57
  }
57
- return result;
58
+ return contentBlock;
58
59
  }
59
60
  function formatSuccessResponse(successData, content) {
60
61
  const data = structuredClone(successData);
@@ -67,7 +68,11 @@ function formatSuccessResponse(successData, content) {
67
68
  }
68
69
  ]
69
70
  };
70
- return mergeResponsesContent(result, content);
71
+ const contetnBlock = mergeResponsesContent(content);
72
+ if (contetnBlock.length > 0) {
73
+ result.content.push(...contetnBlock);
74
+ }
75
+ return result;
71
76
  }
72
77
  function formatErrorResponse(errorData, operation, meta) {
73
78
  let errorResponse;
@@ -20,7 +20,7 @@ export interface SimpleCacheOptions {
20
20
  /**
21
21
  * SimpleCache - Generic cache supporting TTL and/or LRU eviction
22
22
  */
23
- export declare class SimpleCache<T> {
23
+ export declare class SimpleCache<T = any> {
24
24
  private lruCache;
25
25
  private readonly ttlMs;
26
26
  private readonly maxSize;
@@ -1,4 +1,4 @@
1
- import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
1
+ import type { CallToolResult, ContentBlock } from "@modelcontextprotocol/sdk/types.js";
2
2
  /**
3
3
  * Utility functions for formatting MCP responses
4
4
  *
@@ -25,7 +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
+ export declare function mergeResponsesContent(content: any): ContentBlock[];
29
29
  export declare function formatSuccessResponse(successData: SuccessData, content?: any): CallToolResult;
30
30
  /**
31
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.12",
2
+ "version": "0.14.14",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",