@ibm/ibmi-mcp-server 0.1.2 → 0.3.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 (207) hide show
  1. package/README.md +2178 -46
  2. package/dist/config/index.d.ts +2 -0
  3. package/dist/config/index.d.ts.map +1 -1
  4. package/dist/config/index.js +57 -24
  5. package/dist/config/index.js.map +1 -1
  6. package/dist/config/resolver.d.ts.map +1 -1
  7. package/dist/config/resolver.js.map +1 -1
  8. package/dist/ibmi-mcp-server/auth/httpAuthEndpoint.js +1 -1
  9. package/dist/ibmi-mcp-server/services/connectionPool.js +2 -2
  10. package/dist/ibmi-mcp-server/tools/executeSql.tool.d.ts +80 -0
  11. package/dist/ibmi-mcp-server/tools/executeSql.tool.d.ts.map +1 -0
  12. package/dist/ibmi-mcp-server/tools/executeSql.tool.js +356 -0
  13. package/dist/ibmi-mcp-server/tools/executeSql.tool.js.map +1 -0
  14. package/dist/ibmi-mcp-server/tools/generateSql.tool.d.ts +36 -0
  15. package/dist/ibmi-mcp-server/tools/generateSql.tool.d.ts.map +1 -0
  16. package/dist/ibmi-mcp-server/tools/generateSql.tool.js +281 -0
  17. package/dist/ibmi-mcp-server/tools/generateSql.tool.js.map +1 -0
  18. package/dist/ibmi-mcp-server/tools/index.d.ts +85 -0
  19. package/dist/ibmi-mcp-server/tools/index.d.ts.map +1 -0
  20. package/dist/ibmi-mcp-server/tools/index.js +21 -0
  21. package/dist/ibmi-mcp-server/tools/index.js.map +1 -0
  22. package/dist/ibmi-mcp-server/utils/config/configParser.d.ts +9 -0
  23. package/dist/ibmi-mcp-server/utils/config/configParser.d.ts.map +1 -1
  24. package/dist/ibmi-mcp-server/utils/config/configParser.js +58 -0
  25. package/dist/ibmi-mcp-server/utils/config/configParser.js.map +1 -1
  26. package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.js +1 -1
  27. package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.js.map +1 -1
  28. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.d.ts +4 -4
  29. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.d.ts.map +1 -1
  30. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.js +7 -8
  31. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.js.map +1 -1
  32. package/dist/ibmi-mcp-server/utils/config/toolFactory.d.ts +0 -8
  33. package/dist/ibmi-mcp-server/utils/config/toolFactory.d.ts.map +1 -1
  34. package/dist/ibmi-mcp-server/utils/config/toolFactory.js +0 -31
  35. package/dist/ibmi-mcp-server/utils/config/toolFactory.js.map +1 -1
  36. package/dist/ibmi-mcp-server/utils/config/toolsetManager.d.ts +1 -1
  37. package/dist/ibmi-mcp-server/utils/config/toolsetManager.d.ts.map +1 -1
  38. package/dist/ibmi-mcp-server/utils/config/toolsetManager.js +2 -2
  39. package/dist/ibmi-mcp-server/utils/config/toolsetManager.js.map +1 -1
  40. package/dist/ibmi-mcp-server/utils/language/document.d.ts +26 -0
  41. package/dist/ibmi-mcp-server/utils/language/document.d.ts.map +1 -0
  42. package/dist/ibmi-mcp-server/utils/language/document.js +318 -0
  43. package/dist/ibmi-mcp-server/utils/language/document.js.map +1 -0
  44. package/dist/ibmi-mcp-server/utils/language/statement.d.ts +43 -0
  45. package/dist/ibmi-mcp-server/utils/language/statement.d.ts.map +1 -0
  46. package/dist/ibmi-mcp-server/utils/language/statement.js +796 -0
  47. package/dist/ibmi-mcp-server/utils/language/statement.js.map +1 -0
  48. package/dist/ibmi-mcp-server/utils/language/tokens.d.ts +32 -0
  49. package/dist/ibmi-mcp-server/utils/language/tokens.d.ts.map +1 -0
  50. package/dist/ibmi-mcp-server/utils/language/tokens.js +532 -0
  51. package/dist/ibmi-mcp-server/utils/language/tokens.js.map +1 -0
  52. package/dist/ibmi-mcp-server/utils/language/types.d.ts +138 -0
  53. package/dist/ibmi-mcp-server/utils/language/types.d.ts.map +1 -0
  54. package/dist/ibmi-mcp-server/utils/language/types.js +93 -0
  55. package/dist/ibmi-mcp-server/utils/language/types.js.map +1 -0
  56. package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.d.ts +48 -0
  57. package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.d.ts.map +1 -0
  58. package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.js +93 -0
  59. package/dist/ibmi-mcp-server/utils/security/ibmiSqlParser.js.map +1 -0
  60. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.d.ts +35 -59
  61. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.d.ts.map +1 -1
  62. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.js +108 -288
  63. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.js.map +1 -1
  64. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.d.ts +54 -0
  65. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.d.ts.map +1 -0
  66. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.js +91 -0
  67. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidatorFallback.js.map +1 -0
  68. package/dist/index.js +4 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/mcp-server/tools/index.d.ts +13 -2
  71. package/dist/mcp-server/tools/index.d.ts.map +1 -1
  72. package/dist/mcp-server/tools/index.js +29 -9
  73. package/dist/mcp-server/tools/index.js.map +1 -1
  74. package/dist/mcp-server/tools/utils/index.d.ts +7 -0
  75. package/dist/mcp-server/tools/utils/index.d.ts.map +1 -0
  76. package/dist/mcp-server/tools/utils/index.js +7 -0
  77. package/dist/mcp-server/tools/utils/index.js.map +1 -0
  78. package/dist/mcp-server/tools/utils/tool-factory.d.ts +129 -0
  79. package/dist/mcp-server/tools/utils/tool-factory.d.ts.map +1 -0
  80. package/dist/mcp-server/tools/utils/tool-factory.js +179 -0
  81. package/dist/mcp-server/tools/utils/tool-factory.js.map +1 -0
  82. package/dist/mcp-server/tools/utils/types.d.ts +117 -0
  83. package/dist/mcp-server/tools/utils/types.d.ts.map +1 -0
  84. package/dist/mcp-server/tools/utils/types.js +11 -0
  85. package/dist/mcp-server/tools/utils/types.js.map +1 -0
  86. package/dist/mcp-server/transports/core/cleanupTransformStream.d.ts +26 -0
  87. package/dist/mcp-server/transports/core/cleanupTransformStream.d.ts.map +1 -0
  88. package/dist/mcp-server/transports/core/cleanupTransformStream.js +60 -0
  89. package/dist/mcp-server/transports/core/cleanupTransformStream.js.map +1 -0
  90. package/dist/mcp-server/transports/core/statefulTransportManager.d.ts +1 -1
  91. package/dist/mcp-server/transports/core/statefulTransportManager.d.ts.map +1 -1
  92. package/dist/mcp-server/transports/core/statefulTransportManager.js +50 -40
  93. package/dist/mcp-server/transports/core/statefulTransportManager.js.map +1 -1
  94. package/dist/mcp-server/transports/core/statelessTransportManager.d.ts +2 -13
  95. package/dist/mcp-server/transports/core/statelessTransportManager.d.ts.map +1 -1
  96. package/dist/mcp-server/transports/core/statelessTransportManager.js +35 -62
  97. package/dist/mcp-server/transports/core/statelessTransportManager.js.map +1 -1
  98. package/dist/mcp-server/transports/core/transportRequest.d.ts +1 -2
  99. package/dist/mcp-server/transports/core/transportRequest.d.ts.map +1 -1
  100. package/dist/mcp-server/transports/http/mcpTransportMiddleware.d.ts.map +1 -1
  101. package/dist/mcp-server/transports/http/mcpTransportMiddleware.js +1 -3
  102. package/dist/mcp-server/transports/http/mcpTransportMiddleware.js.map +1 -1
  103. package/dist/utils/internal/logger.d.ts +5 -0
  104. package/dist/utils/internal/logger.d.ts.map +1 -1
  105. package/dist/utils/internal/logger.js +65 -36
  106. package/dist/utils/internal/logger.js.map +1 -1
  107. package/package.json +29 -23
  108. package/dist/ibmi-mcp-server/tools/executeSql/index.d.ts +0 -9
  109. package/dist/ibmi-mcp-server/tools/executeSql/index.d.ts.map +0 -1
  110. package/dist/ibmi-mcp-server/tools/executeSql/index.js +0 -9
  111. package/dist/ibmi-mcp-server/tools/executeSql/index.js.map +0 -1
  112. package/dist/ibmi-mcp-server/tools/executeSql/logic.d.ts +0 -51
  113. package/dist/ibmi-mcp-server/tools/executeSql/logic.d.ts.map +0 -1
  114. package/dist/ibmi-mcp-server/tools/executeSql/logic.js +0 -179
  115. package/dist/ibmi-mcp-server/tools/executeSql/logic.js.map +0 -1
  116. package/dist/ibmi-mcp-server/tools/executeSql/registration.d.ts +0 -52
  117. package/dist/ibmi-mcp-server/tools/executeSql/registration.d.ts.map +0 -1
  118. package/dist/ibmi-mcp-server/tools/executeSql/registration.js +0 -161
  119. package/dist/ibmi-mcp-server/tools/executeSql/registration.js.map +0 -1
  120. package/dist/ibmi-mcp-server/tools/generateSql/index.d.ts +0 -13
  121. package/dist/ibmi-mcp-server/tools/generateSql/index.d.ts.map +0 -1
  122. package/dist/ibmi-mcp-server/tools/generateSql/index.js +0 -13
  123. package/dist/ibmi-mcp-server/tools/generateSql/index.js.map +0 -1
  124. package/dist/ibmi-mcp-server/tools/generateSql/logic.d.ts +0 -64
  125. package/dist/ibmi-mcp-server/tools/generateSql/logic.d.ts.map +0 -1
  126. package/dist/ibmi-mcp-server/tools/generateSql/logic.js +0 -190
  127. package/dist/ibmi-mcp-server/tools/generateSql/logic.js.map +0 -1
  128. package/dist/ibmi-mcp-server/tools/generateSql/registration.d.ts +0 -18
  129. package/dist/ibmi-mcp-server/tools/generateSql/registration.d.ts.map +0 -1
  130. package/dist/ibmi-mcp-server/tools/generateSql/registration.js +0 -64
  131. package/dist/ibmi-mcp-server/tools/generateSql/registration.js.map +0 -1
  132. package/dist/mcp-server/tools/catFactFetcher/index.d.ts +0 -8
  133. package/dist/mcp-server/tools/catFactFetcher/index.d.ts.map +0 -1
  134. package/dist/mcp-server/tools/catFactFetcher/index.js +0 -8
  135. package/dist/mcp-server/tools/catFactFetcher/index.js.map +0 -1
  136. package/dist/mcp-server/tools/catFactFetcher/logic.d.ts +0 -52
  137. package/dist/mcp-server/tools/catFactFetcher/logic.d.ts.map +0 -1
  138. package/dist/mcp-server/tools/catFactFetcher/logic.js +0 -95
  139. package/dist/mcp-server/tools/catFactFetcher/logic.js.map +0 -1
  140. package/dist/mcp-server/tools/catFactFetcher/registration.d.ts +0 -9
  141. package/dist/mcp-server/tools/catFactFetcher/registration.d.ts.map +0 -1
  142. package/dist/mcp-server/tools/catFactFetcher/registration.js +0 -43
  143. package/dist/mcp-server/tools/catFactFetcher/registration.js.map +0 -1
  144. package/dist/mcp-server/tools/echoTool/index.d.ts +0 -13
  145. package/dist/mcp-server/tools/echoTool/index.d.ts.map +0 -1
  146. package/dist/mcp-server/tools/echoTool/index.js +0 -13
  147. package/dist/mcp-server/tools/echoTool/index.js.map +0 -1
  148. package/dist/mcp-server/tools/echoTool/logic.d.ts +0 -69
  149. package/dist/mcp-server/tools/echoTool/logic.d.ts.map +0 -1
  150. package/dist/mcp-server/tools/echoTool/logic.js +0 -119
  151. package/dist/mcp-server/tools/echoTool/logic.js.map +0 -1
  152. package/dist/mcp-server/tools/echoTool/registration.d.ts +0 -9
  153. package/dist/mcp-server/tools/echoTool/registration.d.ts.map +0 -1
  154. package/dist/mcp-server/tools/echoTool/registration.js +0 -45
  155. package/dist/mcp-server/tools/echoTool/registration.js.map +0 -1
  156. package/dist/mcp-server/tools/imageTest/index.d.ts +0 -7
  157. package/dist/mcp-server/tools/imageTest/index.d.ts.map +0 -1
  158. package/dist/mcp-server/tools/imageTest/index.js +0 -7
  159. package/dist/mcp-server/tools/imageTest/index.js.map +0 -1
  160. package/dist/mcp-server/tools/imageTest/logic.d.ts +0 -27
  161. package/dist/mcp-server/tools/imageTest/logic.d.ts.map +0 -1
  162. package/dist/mcp-server/tools/imageTest/logic.js +0 -44
  163. package/dist/mcp-server/tools/imageTest/logic.js.map +0 -1
  164. package/dist/mcp-server/tools/imageTest/registration.d.ts +0 -9
  165. package/dist/mcp-server/tools/imageTest/registration.d.ts.map +0 -1
  166. package/dist/mcp-server/tools/imageTest/registration.js +0 -49
  167. package/dist/mcp-server/tools/imageTest/registration.js.map +0 -1
  168. package/dist/mcp-server/tools/utils/tool-utils.d.ts +0 -43
  169. package/dist/mcp-server/tools/utils/tool-utils.d.ts.map +0 -1
  170. package/dist/mcp-server/tools/utils/tool-utils.js +0 -44
  171. package/dist/mcp-server/tools/utils/tool-utils.js.map +0 -1
  172. package/dist/mcp-server/transports/core/headerUtils.d.ts +0 -27
  173. package/dist/mcp-server/transports/core/headerUtils.d.ts.map +0 -1
  174. package/dist/mcp-server/transports/core/headerUtils.js +0 -53
  175. package/dist/mcp-server/transports/core/headerUtils.js.map +0 -1
  176. package/dist/mcp-server/transports/core/honoNodeBridge.d.ts +0 -77
  177. package/dist/mcp-server/transports/core/honoNodeBridge.d.ts.map +0 -1
  178. package/dist/mcp-server/transports/core/honoNodeBridge.js +0 -150
  179. package/dist/mcp-server/transports/core/honoNodeBridge.js.map +0 -1
  180. package/dist/services/duck-db/duckDBConnectionManager.d.ts +0 -55
  181. package/dist/services/duck-db/duckDBConnectionManager.d.ts.map +0 -1
  182. package/dist/services/duck-db/duckDBConnectionManager.js +0 -184
  183. package/dist/services/duck-db/duckDBConnectionManager.js.map +0 -1
  184. package/dist/services/duck-db/duckDBQueryExecutor.d.ts +0 -18
  185. package/dist/services/duck-db/duckDBQueryExecutor.d.ts.map +0 -1
  186. package/dist/services/duck-db/duckDBQueryExecutor.js +0 -115
  187. package/dist/services/duck-db/duckDBQueryExecutor.js.map +0 -1
  188. package/dist/services/duck-db/duckDBService.d.ts +0 -27
  189. package/dist/services/duck-db/duckDBService.d.ts.map +0 -1
  190. package/dist/services/duck-db/duckDBService.js +0 -151
  191. package/dist/services/duck-db/duckDBService.js.map +0 -1
  192. package/dist/services/duck-db/types.d.ts +0 -135
  193. package/dist/services/duck-db/types.d.ts.map +0 -1
  194. package/dist/services/duck-db/types.js +0 -6
  195. package/dist/services/duck-db/types.js.map +0 -1
  196. package/dist/services/llm-providers/openRouterProvider.d.ts +0 -36
  197. package/dist/services/llm-providers/openRouterProvider.d.ts.map +0 -1
  198. package/dist/services/llm-providers/openRouterProvider.js +0 -235
  199. package/dist/services/llm-providers/openRouterProvider.js.map +0 -1
  200. package/dist/services/supabase/supabaseClient.d.ts +0 -25
  201. package/dist/services/supabase/supabaseClient.d.ts.map +0 -1
  202. package/dist/services/supabase/supabaseClient.js +0 -68
  203. package/dist/services/supabase/supabaseClient.js.map +0 -1
  204. package/dist/storage/duckdbExample.d.ts +0 -8
  205. package/dist/storage/duckdbExample.d.ts.map +0 -1
  206. package/dist/storage/duckdbExample.js +0 -197
  207. package/dist/storage/duckdbExample.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/catFactFetcher/logic.ts"],"names":[],"mappings":"AAAA;;;;IAII;AAEJ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsBxB;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;EASpC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;EAYvC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,sBAAsB,CAAC,CA0EjC"}
@@ -1,95 +0,0 @@
1
- /**
2
- * @fileoverview Defines the core logic, schemas, and types for the `get_random_cat_fact` tool.
3
- * This tool fetches a random cat fact from the public Cat Fact Ninja API.
4
- * @module src/mcp-server/tools/catFactFetcher/logic
5
- **/
6
- import { z } from "zod";
7
- import { JsonRpcErrorCode, McpError } from "../../../types-global/errors.js";
8
- import { fetchWithTimeout, getRequestContext, requestContextService, } from "../../../utils/index.js";
9
- import { logOperationError, logOperationStart, logOperationSuccess, } from "../../../utils/internal/logging-helpers.js";
10
- /**
11
- * Zod schema for the raw response from the Cat Fact Ninja API.
12
- * @internal
13
- */
14
- const CatFactApiSchema = z.object({
15
- fact: z.string(),
16
- length: z.number(),
17
- });
18
- /**
19
- * Zod schema for validating input arguments for the `get_random_cat_fact` tool.
20
- */
21
- export const CatFactFetcherInputSchema = z.object({
22
- maxLength: z
23
- .number()
24
- .int("Max length must be an integer.")
25
- .min(1, "Max length must be at least 1.")
26
- .optional()
27
- .describe("Optional: The maximum character length of the cat fact to retrieve."),
28
- });
29
- /**
30
- * Zod schema for the successful response of the `get_random_cat_fact` tool.
31
- */
32
- export const CatFactFetcherResponseSchema = z.object({
33
- fact: z.string().describe("The retrieved cat fact."),
34
- length: z.number().int().describe("The character length of the cat fact."),
35
- requestedMaxLength: z
36
- .number()
37
- .int()
38
- .optional()
39
- .describe("The maximum length that was requested for the fact."),
40
- timestamp: z
41
- .string()
42
- .datetime()
43
- .describe("ISO 8601 timestamp of when the response was generated."),
44
- });
45
- /**
46
- * Processes the core logic for the `get_random_cat_fact` tool.
47
- * It calls the Cat Fact Ninja API and returns the fetched fact.
48
- * @param params - The validated input parameters for the tool.
49
- * @returns A promise that resolves to an object containing the cat fact data.
50
- * @throws {McpError} If the API request fails or returns an error.
51
- */
52
- export async function catFactFetcherLogic(params) {
53
- const context = getRequestContext() ??
54
- requestContextService.createRequestContext({
55
- operation: "catFactFetcherLogic",
56
- });
57
- logOperationStart(context, "Processing get_random_cat_fact logic.", {
58
- toolInput: params,
59
- });
60
- let apiUrl = "https://catfact.ninja/fact";
61
- if (params.maxLength !== undefined) {
62
- apiUrl += `?max_length=${params.maxLength}`;
63
- }
64
- logOperationStart(context, `Fetching random cat fact from: ${apiUrl}`);
65
- const CAT_FACT_API_TIMEOUT_MS = 5000;
66
- const response = await fetchWithTimeout(apiUrl, CAT_FACT_API_TIMEOUT_MS, context);
67
- if (!response.ok) {
68
- const errorText = await response.text();
69
- throw new McpError(JsonRpcErrorCode.ServiceUnavailable, `Cat Fact API request failed: ${response.status} ${response.statusText}`, {
70
- ...context,
71
- httpStatusCode: response.status,
72
- responseBody: errorText,
73
- });
74
- }
75
- const rawData = await response.json();
76
- try {
77
- const data = CatFactApiSchema.parse(rawData);
78
- const toolResponse = {
79
- fact: data.fact,
80
- length: data.length,
81
- requestedMaxLength: params.maxLength,
82
- timestamp: new Date().toISOString(),
83
- };
84
- logOperationSuccess(context, "Random cat fact fetched and processed successfully.", { factLength: toolResponse.length });
85
- return toolResponse;
86
- }
87
- catch (validationError) {
88
- logOperationError(context, "Cat Fact API response validation failed", validationError, { receivedData: rawData });
89
- throw new McpError(JsonRpcErrorCode.ServiceUnavailable, "Cat Fact API returned unexpected data format.", {
90
- ...context,
91
- cause: validationError,
92
- });
93
- }
94
- }
95
- //# sourceMappingURL=logic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/catFactFetcher/logic.ts"],"names":[],"mappings":"AAAA;;;;IAII;AAEJ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAE7C;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,gCA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AC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,QAAQ,CAChB,gBAAgB,CAAC,kBAAkB,EACnC,gCAAgC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,EACxE;YACE,GAAG,OAAO;YACV,cAAc,EAAE,QAAQ,CAAC,MAAM;YAC/B,YAAY,EAAE,SAAS;SACxB,CACF,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEtC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE7C,MAAM,YAAY,GAA2B;YAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,kBAAkB,EAAE,MAAM,CAAC,SAAS;YACpC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC;QAEF,mBAAmB,CACjB,OAAO,EACP,qDAAqD,EACrD,EAAE,UAAU,EAAE,YAAY,CAAC,MAAM,EAAE,CACpC,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC;IAAC,OAAO,eAAe,EAAE,CAAC;QACzB,iBAAiB,CACf,OAAO,EACP,yCAAyC,EACzC,eAAe,EACf,EAAE,YAAY,EAAE,OAAO,EAAE,CAC1B,CAAC;QACF,MAAM,IAAI,QAAQ,CAChB,gBAAgB,CAAC,kBAAkB,EACnC,+CAA+C,EAC/C;YACE,GAAG,OAAO;YACV,KAAK,EAAE,eAAe;SACvB,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * @fileoverview Handles the registration of the `get_random_cat_fact` tool.
3
- * This module acts as the "handler" layer, connecting the pure business logic to the
4
- * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
- * @module src/mcp-server/tools/catFactFetcher/registration
6
- **/
7
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
- export declare const registerCatFactFetcherTool: (server: McpServer) => Promise<void>;
9
- //# sourceMappingURL=registration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/catFactFetcher/registration.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA6BpE,eAAO,MAAM,0BAA0B,GACrC,QAAQ,SAAS,KAChB,OAAO,CAAC,IAAI,CAqCd,CAAC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * @fileoverview Handles the registration of the `get_random_cat_fact` tool.
3
- * This module acts as the "handler" layer, connecting the pure business logic to the
4
- * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
- * @module src/mcp-server/tools/catFactFetcher/registration
6
- **/
7
- import { JsonRpcErrorCode } from "../../../types-global/errors.js";
8
- import { ErrorHandler, requestContextService } from "../../../utils/index.js";
9
- import { logOperationStart, logOperationSuccess, } from "../../../utils/internal/logging-helpers.js";
10
- import { createToolHandler, } from "../../tools/utils/tool-utils.js";
11
- import { CatFactFetcherInputSchema, catFactFetcherLogic, CatFactFetcherResponseSchema, } from "./logic.js";
12
- const TOOL_NAME = "get_random_cat_fact";
13
- const TOOL_DESCRIPTION = "Fetches a random cat fact from a public API. Optionally, a maximum length for the fact can be specified.";
14
- const responseFormatter = (result) => ({
15
- structuredContent: result,
16
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
17
- });
18
- export const registerCatFactFetcherTool = async (server) => {
19
- const registrationContext = requestContextService.createRequestContext({
20
- operation: "RegisterTool",
21
- toolName: TOOL_NAME,
22
- });
23
- logOperationStart(registrationContext, `Registering tool: '${TOOL_NAME}'`);
24
- await ErrorHandler.tryCatch(async () => {
25
- server.registerTool(TOOL_NAME, {
26
- title: "Get Random Cat Fact",
27
- description: TOOL_DESCRIPTION,
28
- inputSchema: CatFactFetcherInputSchema.shape,
29
- outputSchema: CatFactFetcherResponseSchema.shape,
30
- annotations: {
31
- readOnlyHint: true,
32
- openWorldHint: true,
33
- },
34
- }, createToolHandler(TOOL_NAME, catFactFetcherLogic, responseFormatter));
35
- logOperationSuccess(registrationContext, `Tool '${TOOL_NAME}' registered successfully.`);
36
- }, {
37
- operation: `RegisteringTool_${TOOL_NAME}`,
38
- context: registrationContext,
39
- errorCode: JsonRpcErrorCode.InitializationFailed,
40
- critical: true,
41
- });
42
- };
43
- //# sourceMappingURL=registration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/catFactFetcher/registration.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAGJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,iBAAiB,GAElB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EAEnB,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AAEpB,MAAM,SAAS,GAAG,qBAAqB,CAAC;AACxC,MAAM,gBAAgB,GACpB,0GAA0G,CAAC;AAE7G,MAAM,iBAAiB,GAA8C,CACnE,MAAM,EACN,EAAE,CAAC,CAAC;IACJ,iBAAiB,EAAE,MAAM;IACzB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;CACnE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAAiB,EACF,EAAE;IACjB,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,oBAAoB,CAAC;QACrE,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAC;IAEH,iBAAiB,CAAC,mBAAmB,EAAE,sBAAsB,SAAS,GAAG,CAAC,CAAC;IAE3E,MAAM,YAAY,CAAC,QAAQ,CACzB,KAAK,IAAI,EAAE;QACT,MAAM,CAAC,YAAY,CACjB,SAAS,EACT;YACE,KAAK,EAAE,qBAAqB;YAC5B,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,yBAAyB,CAAC,KAAK;YAC5C,YAAY,EAAE,4BAA4B,CAAC,KAAK;YAChD,WAAW,EAAE;gBACX,YAAY,EAAE,IAAI;gBAClB,aAAa,EAAE,IAAI;aACpB;SACF,EACD,iBAAiB,CAAC,SAAS,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,CACrE,CAAC;QAEF,mBAAmB,CACjB,mBAAmB,EACnB,SAAS,SAAS,4BAA4B,CAC/C,CAAC;IACJ,CAAC,EACD;QACE,SAAS,EAAE,mBAAmB,SAAS,EAAE;QACzC,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;QAChD,QAAQ,EAAE,IAAI;KACf,CACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * @fileoverview Barrel file for the `echo_message` tool.
3
- * This file serves as the public interface for the echo tool module,
4
- * primarily exporting the `registerEchoTool` function. This function is
5
- * responsible for registering the echo tool with an MCP server instance,
6
- * making it available for invocation by clients.
7
- *
8
- * Consuming modules should import from this barrel file to access
9
- * the echo tool's registration capabilities.
10
- * @module src/mcp-server/tools/echoTool/index
11
- */
12
- export { registerEchoTool } from "./registration.js";
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/echoTool/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * @fileoverview Barrel file for the `echo_message` tool.
3
- * This file serves as the public interface for the echo tool module,
4
- * primarily exporting the `registerEchoTool` function. This function is
5
- * responsible for registering the echo tool with an MCP server instance,
6
- * making it available for invocation by clients.
7
- *
8
- * Consuming modules should import from this barrel file to access
9
- * the echo tool's registration capabilities.
10
- * @module src/mcp-server/tools/echoTool/index
11
- */
12
- export { registerEchoTool } from "./registration.js";
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/echoTool/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,69 +0,0 @@
1
- /**
2
- * @fileoverview Defines the core logic, schemas, and types for the `echo_message` tool.
3
- * This module is the single source of truth for the tool's data contracts (Zod schemas)
4
- * and its pure business logic.
5
- * @module src/mcp-server/tools/echoTool/logic
6
- **/
7
- import { z } from "zod";
8
- /**
9
- * Defines the valid formatting modes for the echo tool operation.
10
- */
11
- export declare const ECHO_MODES: readonly ["standard", "uppercase", "lowercase"];
12
- /**
13
- * Zod schema defining the input parameters for the `echo_message` tool.
14
- * CRITICAL: The descriptions are sent to the LLM and must be clear.
15
- */
16
- export declare const EchoToolInputSchema: z.ZodObject<{
17
- message: z.ZodString;
18
- mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["standard", "uppercase", "lowercase"]>>>;
19
- repeat: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
20
- includeTimestamp: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
21
- }, "strip", z.ZodTypeAny, {
22
- message: string;
23
- repeat: number;
24
- mode: "uppercase" | "standard" | "lowercase";
25
- includeTimestamp: boolean;
26
- }, {
27
- message: string;
28
- repeat?: number | undefined;
29
- mode?: "uppercase" | "standard" | "lowercase" | undefined;
30
- includeTimestamp?: boolean | undefined;
31
- }>;
32
- /**
33
- * Zod schema for the successful response of the `echo_message` tool.
34
- */
35
- export declare const EchoToolResponseSchema: z.ZodObject<{
36
- originalMessage: z.ZodString;
37
- formattedMessage: z.ZodString;
38
- repeatedMessage: z.ZodString;
39
- mode: z.ZodEnum<["standard", "uppercase", "lowercase"]>;
40
- repeatCount: z.ZodNumber;
41
- timestamp: z.ZodOptional<z.ZodString>;
42
- }, "strip", z.ZodTypeAny, {
43
- originalMessage: string;
44
- mode: "uppercase" | "standard" | "lowercase";
45
- formattedMessage: string;
46
- repeatedMessage: string;
47
- repeatCount: number;
48
- timestamp?: string | undefined;
49
- }, {
50
- originalMessage: string;
51
- mode: "uppercase" | "standard" | "lowercase";
52
- formattedMessage: string;
53
- repeatedMessage: string;
54
- repeatCount: number;
55
- timestamp?: string | undefined;
56
- }>;
57
- export type EchoToolInput = z.infer<typeof EchoToolInputSchema>;
58
- export type EchoToolResponse = z.infer<typeof EchoToolResponseSchema>;
59
- /**
60
- * Processes the core logic for the `echo_message` tool.
61
- * This function is pure; it processes inputs and returns a result or throws an error.
62
- * It retrieves the request context from AsyncLocalStorage.
63
- *
64
- * @param params - The validated input parameters.
65
- * @returns A promise resolving with the structured response data.
66
- * @throws {McpError} If the logic encounters an unrecoverable issue.
67
- */
68
- export declare function echoToolLogic(params: EchoToolInput): Promise<EchoToolResponse>;
69
- //# sourceMappingURL=logic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/echoTool/logic.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;GAEG;AACH,eAAO,MAAM,UAAU,iDAAkD,CAAC;AAQ1E;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EA8B9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;EAuBjC,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,gBAAgB,CAAC,CAoD3B"}
@@ -1,119 +0,0 @@
1
- /**
2
- * @fileoverview Defines the core logic, schemas, and types for the `echo_message` tool.
3
- * This module is the single source of truth for the tool's data contracts (Zod schemas)
4
- * and its pure business logic.
5
- * @module src/mcp-server/tools/echoTool/logic
6
- **/
7
- import { z } from "zod";
8
- import { JsonRpcErrorCode, McpError } from "../../../types-global/errors.js";
9
- import { getRequestContext } from "../../../utils/index.js";
10
- import { logger } from "../../../utils/internal/logger.js";
11
- /**
12
- * Defines the valid formatting modes for the echo tool operation.
13
- */
14
- export const ECHO_MODES = ["standard", "uppercase", "lowercase"];
15
- /**
16
- * A constant for the magic string used to trigger a test error.
17
- * This improves maintainability by avoiding hardcoded strings.
18
- */
19
- const TEST_ERROR_TRIGGER_MESSAGE = "fail";
20
- /**
21
- * Zod schema defining the input parameters for the `echo_message` tool.
22
- * CRITICAL: The descriptions are sent to the LLM and must be clear.
23
- */
24
- export const EchoToolInputSchema = z.object({
25
- message: z
26
- .string()
27
- .min(1, "Message cannot be empty.")
28
- .max(1000, "Message cannot exceed 1000 characters.")
29
- .describe(`The message to echo back. To trigger a test error, provide the exact message '${TEST_ERROR_TRIGGER_MESSAGE}'.`),
30
- mode: z
31
- .enum(ECHO_MODES)
32
- .optional()
33
- .default("standard")
34
- .describe("Specifies how the message should be formatted. Defaults to 'standard'."),
35
- repeat: z
36
- .number()
37
- .int()
38
- .min(1)
39
- .max(10)
40
- .optional()
41
- .default(1)
42
- .describe("The number of times to repeat the message. Defaults to 1."),
43
- includeTimestamp: z
44
- .boolean()
45
- .optional()
46
- .default(true)
47
- .describe("Whether to include an ISO 8601 timestamp in the response. Defaults to true."),
48
- });
49
- /**
50
- * Zod schema for the successful response of the `echo_message` tool.
51
- */
52
- export const EchoToolResponseSchema = z.object({
53
- originalMessage: z
54
- .string()
55
- .describe("The original message provided in the input."),
56
- formattedMessage: z
57
- .string()
58
- .describe("The message after applying the specified formatting mode."),
59
- repeatedMessage: z
60
- .string()
61
- .describe("The formatted message repeated the specified number of times."),
62
- mode: z.enum(ECHO_MODES).describe("The formatting mode that was applied."),
63
- repeatCount: z
64
- .number()
65
- .int()
66
- .min(1)
67
- .describe("The number of times the message was repeated."),
68
- timestamp: z
69
- .string()
70
- .datetime()
71
- .optional()
72
- .describe("Optional ISO 8601 timestamp of when the response was generated."),
73
- });
74
- /**
75
- * Processes the core logic for the `echo_message` tool.
76
- * This function is pure; it processes inputs and returns a result or throws an error.
77
- * It retrieves the request context from AsyncLocalStorage.
78
- *
79
- * @param params - The validated input parameters.
80
- * @returns A promise resolving with the structured response data.
81
- * @throws {McpError} If the logic encounters an unrecoverable issue.
82
- */
83
- export async function echoToolLogic(params) {
84
- const context = getRequestContext();
85
- logger.debug({ ...context, toolInput: params }, "Processing echo message logic.");
86
- // The logic layer MUST throw a structured error on failure.
87
- if (params.message === TEST_ERROR_TRIGGER_MESSAGE) {
88
- throw new McpError(JsonRpcErrorCode.ValidationError, `Deliberate failure triggered: the message was '${TEST_ERROR_TRIGGER_MESSAGE}'.`, { toolName: "echo_message" });
89
- }
90
- let formattedMessage = params.message;
91
- switch (params.mode) {
92
- case "uppercase":
93
- formattedMessage = params.message.toUpperCase();
94
- break;
95
- case "lowercase":
96
- formattedMessage = params.message.toLowerCase();
97
- break;
98
- }
99
- const repeatedMessage = Array(params.repeat).fill(formattedMessage).join(" ");
100
- const response = {
101
- originalMessage: params.message,
102
- formattedMessage,
103
- repeatedMessage,
104
- mode: params.mode,
105
- repeatCount: params.repeat,
106
- };
107
- if (params.includeTimestamp) {
108
- response.timestamp = new Date().toISOString();
109
- }
110
- logger.debug({
111
- ...context,
112
- responseSummary: {
113
- messageLength: response.repeatedMessage.length,
114
- timestampGenerated: !!response.timestamp,
115
- },
116
- }, "Echo message processed successfully.");
117
- return response;
118
- }
119
- //# sourceMappingURL=logic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/echoTool/logic.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,CAAU,CAAC;AAE1E;;;GAGG;AACH,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;SAClC,GAAG,CAAC,IAAI,EAAE,wCAAwC,CAAC;SACnD,QAAQ,CACP,iFAAiF,0BAA0B,IAAI,CAChH;IACH,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,UAAU,CAAC;SAChB,QAAQ,EAAE;SACV,OAAO,CAAC,UAAU,CAAC;SACnB,QAAQ,CACP,wEAAwE,CACzE;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,C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,EAChF,EAAE,QAAQ,EAAE,cAAc,EAAE,CAC7B,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC;IACtC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,WAAW;YACd,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAChD,MAAM;QACR,KAAK,WAAW;YACd,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAChD,MAAM;IACV,CAAC;IAED,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9E,MAAM,QAAQ,GAAqB;QACjC,eAAe,EAAE,MAAM,CAAC,OAAO;QAC/B,gBAAgB;QAChB,eAAe;QACf,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,MAAM;KAC3B,CAAC;IAEF,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,QAAQ,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,KAAK,CACV;QACE,GAAG,OAAO;QACV,eAAe,EAAE;YACf,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,MAAM;YAC9C,kBAAkB,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS;SACzC;KACF,EACD,sCAAsC,CACvC,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * @fileoverview Handles registration and error handling for the `echo_message` tool.
3
- * This module acts as the "handler" layer, connecting the pure business logic to the
4
- * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
- * @module src/mcp-server/tools/echoTool/registration
6
- **/
7
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
- export declare const registerEchoTool: (server: McpServer) => Promise<void>;
9
- //# sourceMappingURL=registration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/echoTool/registration.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0BpE,eAAO,MAAM,gBAAgB,GAAU,QAAQ,SAAS,KAAG,OAAO,CAAC,IAAI,CAqCtE,CAAC"}
@@ -1,45 +0,0 @@
1
- /**
2
- * @fileoverview Handles registration and error handling for the `echo_message` tool.
3
- * This module acts as the "handler" layer, connecting the pure business logic to the
4
- * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
- * @module src/mcp-server/tools/echoTool/registration
6
- **/
7
- import { JsonRpcErrorCode } from "../../../types-global/errors.js";
8
- import { ErrorHandler, requestContextService } from "../../../utils/index.js";
9
- import { logOperationStart, logOperationSuccess, } from "../../../utils/internal/logging-helpers.js";
10
- import { createToolHandler } from "../utils/tool-utils.js";
11
- import { EchoToolInputSchema, echoToolLogic, EchoToolResponseSchema, } from "./logic.js";
12
- const TOOL_NAME = "echo_message";
13
- const TOOL_DESCRIPTION = "Echoes a message back with optional formatting and repetition.";
14
- const responseFormatter = (result) => ({
15
- structuredContent: result,
16
- content: [
17
- { type: "text", text: `Success: ${JSON.stringify(result, null, 2)}` },
18
- ],
19
- });
20
- export const registerEchoTool = async (server) => {
21
- const registrationContext = requestContextService.createRequestContext({
22
- operation: "RegisterTool",
23
- toolName: TOOL_NAME,
24
- });
25
- logOperationStart(registrationContext, `Registering tool: '${TOOL_NAME}'`);
26
- await ErrorHandler.tryCatch(async () => {
27
- server.registerTool(TOOL_NAME, {
28
- title: "Echo Message",
29
- description: TOOL_DESCRIPTION,
30
- inputSchema: EchoToolInputSchema.shape,
31
- outputSchema: EchoToolResponseSchema.shape,
32
- annotations: {
33
- readOnlyHint: true,
34
- openWorldHint: false,
35
- },
36
- }, createToolHandler(TOOL_NAME, echoToolLogic, responseFormatter));
37
- logOperationSuccess(registrationContext, `Tool '${TOOL_NAME}' registered successfully.`);
38
- }, {
39
- operation: `RegisteringTool_${TOOL_NAME}`,
40
- context: registrationContext,
41
- errorCode: JsonRpcErrorCode.InitializationFailed,
42
- critical: true,
43
- });
44
- };
45
- //# sourceMappingURL=registration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/echoTool/registration.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAGJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,aAAa,EAEb,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,SAAS,GAAG,cAAc,CAAC;AACjC,MAAM,gBAAgB,GACpB,gEAAgE,CAAC;AAEnE,MAAM,iBAAiB,GAAwC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1E,iBAAiB,EAAE,MAAM;IACzB,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;KACtE;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAiB,EAAiB,EAAE;IACzE,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,oBAAoB,CAAC;QACrE,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAC;IAEH,iBAAiB,CAAC,mBAAmB,EAAE,sBAAsB,SAAS,GAAG,CAAC,CAAC;IAE3E,MAAM,YAAY,CAAC,QAAQ,CACzB,KAAK,IAAI,EAAE;QACT,MAAM,CAAC,YAAY,CACjB,SAAS,EACT;YACE,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,mBAAmB,CAAC,KAAK;YACtC,YAAY,EAAE,sBAAsB,CAAC,KAAK;YAC1C,WAAW,EAAE;gBACX,YAAY,EAAE,IAAI;gBAClB,aAAa,EAAE,KAAK;aACrB;SACF,EACD,iBAAiB,CAAC,SAAS,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAC/D,CAAC;QAEF,mBAAmB,CACjB,mBAAmB,EACnB,SAAS,SAAS,4BAA4B,CAC/C,CAAC;IACJ,CAAC,EACD;QACE,SAAS,EAAE,mBAAmB,SAAS,EAAE;QACzC,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;QAChD,QAAQ,EAAE,IAAI;KACf,CACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * @fileoverview Barrel file for the fetch_image_test tool.
3
- * Exports the tool's registration function.
4
- * @module src/mcp-server/tools/imageTest/index
5
- */
6
- export { registerFetchImageTestTool } from "./registration.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/imageTest/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * @fileoverview Barrel file for the fetch_image_test tool.
3
- * Exports the tool's registration function.
4
- * @module src/mcp-server/tools/imageTest/index
5
- */
6
- export { registerFetchImageTestTool } from "./registration.js";
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/imageTest/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * @fileoverview Defines the core logic, schemas, and types for the `fetch_image_test` tool.
3
- * This tool fetches a random cat image from the public cataas.com API.
4
- * @module src/mcp-server/tools/imageTest/logic
5
- **/
6
- import { z } from "zod";
7
- export declare const FetchImageTestInputSchema: z.ZodObject<{
8
- trigger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
- }, "strip", z.ZodTypeAny, {
10
- trigger: boolean;
11
- }, {
12
- trigger?: boolean | undefined;
13
- }>;
14
- export type FetchImageTestInput = z.infer<typeof FetchImageTestInputSchema>;
15
- export declare const FetchImageTestResponseSchema: z.ZodObject<{
16
- data: z.ZodString;
17
- mimeType: z.ZodString;
18
- }, "strip", z.ZodTypeAny, {
19
- data: string;
20
- mimeType: string;
21
- }, {
22
- data: string;
23
- mimeType: string;
24
- }>;
25
- export type FetchImageTestResponse = z.infer<typeof FetchImageTestResponseSchema>;
26
- export declare function fetchImageTestLogic(input: FetchImageTestInput): Promise<FetchImageTestResponse>;
27
- //# sourceMappingURL=logic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/imageTest/logic.ts"],"names":[],"mappings":"AAAA;;;;IAII;AAEJ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,yBAAyB;;;;;;EAMpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,4BAA4B;;;;;;;;;EAKvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAIF,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,sBAAsB,CAAC,CAqCjC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * @fileoverview Defines the core logic, schemas, and types for the `fetch_image_test` tool.
3
- * This tool fetches a random cat image from the public cataas.com API.
4
- * @module src/mcp-server/tools/imageTest/logic
5
- **/
6
- import { z } from "zod";
7
- import { JsonRpcErrorCode, McpError } from "../../../types-global/errors.js";
8
- import { fetchWithTimeout, getRequestContext, requestContextService, } from "../../../utils/index.js";
9
- import { logOperationStart } from "../../../utils/internal/logging-helpers.js";
10
- export const FetchImageTestInputSchema = z.object({
11
- trigger: z
12
- .boolean()
13
- .optional()
14
- .default(true)
15
- .describe("A trigger to invoke the tool and fetch a new cat image."),
16
- });
17
- export const FetchImageTestResponseSchema = z.object({
18
- data: z.string().describe("Base64 encoded image data."),
19
- mimeType: z
20
- .string()
21
- .describe("The MIME type of the image (e.g., 'image/jpeg')."),
22
- });
23
- const CAT_API_URL = "https://cataas.com/cat";
24
- export async function fetchImageTestLogic(input) {
25
- const context = getRequestContext() ??
26
- requestContextService.createRequestContext({
27
- operation: "fetchImageTestLogic",
28
- });
29
- logOperationStart(context, `Executing 'fetch_image_test'. Trigger: ${input.trigger}`);
30
- const response = await fetchWithTimeout(CAT_API_URL, 5000, context);
31
- if (!response.ok) {
32
- throw new McpError(JsonRpcErrorCode.ServiceUnavailable, `Image API request failed: ${response.status} ${response.statusText}`, { ...context, httpStatusCode: response.status });
33
- }
34
- const contentType = response.headers.get("content-type") || "";
35
- if (!contentType.startsWith("image/")) {
36
- throw new McpError(JsonRpcErrorCode.ServiceUnavailable, "Image API returned a non-image response.", { ...context, contentType });
37
- }
38
- const imageBuffer = Buffer.from(await response.arrayBuffer());
39
- return {
40
- data: imageBuffer.toString("base64"),
41
- mimeType: contentType,
42
- };
43
- }
44
- //# sourceMappingURL=logic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic.js","sourceRoot":"","sources":["../../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QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,EACrE,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,MAAM,EAAE,CAChD,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAC/D,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,QAAQ,CAChB,gBAAgB,CAAC,kBAAkB,EACnC,0CAA0C,EAC1C,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,CAC5B,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAE9D,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACpC,QAAQ,EAAE,WAAW;KACtB,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * @fileoverview Handles registration of the `fetch_image_test` tool.
3
- * This module acts as the "handler" layer, connecting the pure business logic to the
4
- * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
- * @module src/mcp-server/tools/imageTest/registration
6
- **/
7
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
- export declare const registerFetchImageTestTool: (server: McpServer) => Promise<void>;
9
- //# sourceMappingURL=registration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/imageTest/registration.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmCpE,eAAO,MAAM,0BAA0B,GACrC,QAAQ,SAAS,KAChB,OAAO,CAAC,IAAI,CAoCd,CAAC"}