@utaba/ucm-mcp-server 6.5.0 → 6.6.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 (198) hide show
  1. package/dist/clients/UcmLocalApiClient.d.ts +175 -2
  2. package/dist/clients/UcmLocalApiClient.js +203 -3
  3. package/dist/index.js +1 -1
  4. package/dist/mcp-server/clients/UcmLocalApiClient.d.ts +399 -0
  5. package/dist/mcp-server/clients/UcmLocalApiClient.js +719 -0
  6. package/dist/mcp-server/index.d.ts +3 -0
  7. package/dist/mcp-server/index.js +68 -0
  8. package/dist/mcp-server/interfaces/ILogger.d.ts +8 -0
  9. package/dist/mcp-server/interfaces/ILogger.js +4 -0
  10. package/dist/mcp-server/interfaces/IMcpTool.d.ts +7 -0
  11. package/dist/mcp-server/interfaces/IMcpTool.js +3 -0
  12. package/dist/mcp-server/logging/ConsoleLogger.d.ts +16 -0
  13. package/dist/mcp-server/logging/ConsoleLogger.js +45 -0
  14. package/dist/mcp-server/logging/LoggerFactory.d.ts +9 -0
  15. package/dist/mcp-server/logging/LoggerFactory.js +12 -0
  16. package/dist/mcp-server/server/McpConfig.d.ts +26 -0
  17. package/dist/mcp-server/server/McpConfig.js +90 -0
  18. package/dist/mcp-server/server/McpHandler.d.ts +12 -0
  19. package/dist/mcp-server/server/McpHandler.js +84 -0
  20. package/dist/mcp-server/server/McpServer.d.ts +15 -0
  21. package/dist/mcp-server/server/McpServer.js +49 -0
  22. package/dist/mcp-server/server/ToolRegistry.d.ts +23 -0
  23. package/dist/mcp-server/server/ToolRegistry.js +169 -0
  24. package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.d.ts +21 -0
  25. package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.js +146 -0
  26. package/dist/mcp-server/tools/authorization/SignOutTool.d.ts +23 -0
  27. package/dist/mcp-server/tools/authorization/SignOutTool.js +128 -0
  28. package/dist/mcp-server/tools/base/BaseToolController.d.ts +19 -0
  29. package/dist/mcp-server/tools/base/BaseToolController.js +58 -0
  30. package/dist/mcp-server/tools/connections/AccessConnectionTool.d.ts +21 -0
  31. package/dist/mcp-server/tools/connections/AccessConnectionTool.js +107 -0
  32. package/dist/mcp-server/tools/connections/CallRemoteToolTool.d.ts +22 -0
  33. package/dist/mcp-server/tools/connections/CallRemoteToolTool.js +124 -0
  34. package/dist/mcp-server/tools/core/DeleteArtifactTool.d.ts +11 -0
  35. package/dist/mcp-server/tools/core/DeleteArtifactTool.js +83 -0
  36. package/dist/mcp-server/tools/core/EditArtifactMetadataTool.d.ts +12 -0
  37. package/dist/mcp-server/tools/core/EditArtifactMetadataTool.js +173 -0
  38. package/dist/mcp-server/tools/core/GetArtifactTool.d.ts +13 -0
  39. package/dist/mcp-server/tools/core/GetArtifactTool.js +124 -0
  40. package/dist/mcp-server/tools/core/GetArtifactVersionsTool.d.ts +11 -0
  41. package/dist/mcp-server/tools/core/GetArtifactVersionsTool.js +63 -0
  42. package/dist/mcp-server/tools/core/GetChunkTool.d.ts +11 -0
  43. package/dist/mcp-server/tools/core/GetChunkTool.js +56 -0
  44. package/dist/mcp-server/tools/core/ListArtifactsTool.d.ts +11 -0
  45. package/dist/mcp-server/tools/core/ListArtifactsTool.js +84 -0
  46. package/dist/mcp-server/tools/core/MoveArtifactTool.d.ts +12 -0
  47. package/dist/mcp-server/tools/core/MoveArtifactTool.js +104 -0
  48. package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.d.ts +15 -0
  49. package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.js +277 -0
  50. package/dist/mcp-server/tools/core/PublishArtifactTool.d.ts +13 -0
  51. package/dist/mcp-server/tools/core/PublishArtifactTool.js +218 -0
  52. package/dist/mcp-server/tools/core/SearchArtifactsTool.d.ts +11 -0
  53. package/dist/mcp-server/tools/core/SearchArtifactsTool.js +137 -0
  54. package/dist/mcp-server/tools/list/ListNamespaceController.d.ts +1 -0
  55. package/dist/mcp-server/tools/list/ListNamespaceController.js +8 -0
  56. package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.d.ts +14 -0
  57. package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.js +58 -0
  58. package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +14 -0
  59. package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.js +57 -0
  60. package/dist/mcp-server/tools/memory-graph/GraphCreateTool.d.ts +14 -0
  61. package/dist/mcp-server/tools/memory-graph/GraphCreateTool.js +64 -0
  62. package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +14 -0
  63. package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.js +45 -0
  64. package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +14 -0
  65. package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.js +45 -0
  66. package/dist/mcp-server/tools/memory-graph/GraphExploreTool.d.ts +14 -0
  67. package/dist/mcp-server/tools/memory-graph/GraphExploreTool.js +73 -0
  68. package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.d.ts +14 -0
  69. package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.js +68 -0
  70. package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.d.ts +14 -0
  71. package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.js +62 -0
  72. package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.d.ts +14 -0
  73. package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.js +49 -0
  74. package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.d.ts +14 -0
  75. package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.js +62 -0
  76. package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.d.ts +14 -0
  77. package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.js +34 -0
  78. package/dist/mcp-server/tools/memory-graph/GraphListTool.d.ts +14 -0
  79. package/dist/mcp-server/tools/memory-graph/GraphListTool.js +45 -0
  80. package/dist/mcp-server/tools/memory-graph/GraphOpenTool.d.ts +15 -0
  81. package/dist/mcp-server/tools/memory-graph/GraphOpenTool.js +50 -0
  82. package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.d.ts +14 -0
  83. package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.js +108 -0
  84. package/dist/mcp-server/tools/memory-graph/GraphSearchTool.d.ts +14 -0
  85. package/dist/mcp-server/tools/memory-graph/GraphSearchTool.js +94 -0
  86. package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.d.ts +14 -0
  87. package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.js +114 -0
  88. package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +14 -0
  89. package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.js +58 -0
  90. package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.d.ts +14 -0
  91. package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.js +25 -0
  92. package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.d.ts +14 -0
  93. package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.js +31 -0
  94. package/dist/mcp-server/tools/repository/CreateRepositoryTool.d.ts +12 -0
  95. package/dist/mcp-server/tools/repository/CreateRepositoryTool.js +116 -0
  96. package/dist/mcp-server/tools/repository/GetRepositoryTool.d.ts +12 -0
  97. package/dist/mcp-server/tools/repository/GetRepositoryTool.js +85 -0
  98. package/dist/mcp-server/tools/repository/UpdateRepositoryTool.d.ts +12 -0
  99. package/dist/mcp-server/tools/repository/UpdateRepositoryTool.js +115 -0
  100. package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.d.ts +19 -0
  101. package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.js +90 -0
  102. package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.d.ts +21 -0
  103. package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.js +133 -0
  104. package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.d.ts +22 -0
  105. package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.js +146 -0
  106. package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.d.ts +18 -0
  107. package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.js +108 -0
  108. package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.d.ts +22 -0
  109. package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.js +125 -0
  110. package/dist/mcp-server/tools/utility/AuthorIndexTool.d.ts +11 -0
  111. package/dist/mcp-server/tools/utility/AuthorIndexTool.js +49 -0
  112. package/dist/mcp-server/tools/utility/AuthorRecentsTool.d.ts +11 -0
  113. package/dist/mcp-server/tools/utility/AuthorRecentsTool.js +49 -0
  114. package/dist/mcp-server/tools/utility/ListRepositoriesTool.d.ts +11 -0
  115. package/dist/mcp-server/tools/utility/ListRepositoriesTool.js +68 -0
  116. package/dist/mcp-server/tools/utility/QuickstartTool.d.ts +11 -0
  117. package/dist/mcp-server/tools/utility/QuickstartTool.js +36 -0
  118. package/dist/mcp-server/types/UcmApiTypes.d.ts +40 -0
  119. package/dist/mcp-server/types/UcmApiTypes.js +4 -0
  120. package/dist/mcp-server/utils/McpErrorHandler.d.ts +25 -0
  121. package/dist/mcp-server/utils/McpErrorHandler.js +67 -0
  122. package/dist/mcp-server/utils/PathUtils.d.ts +61 -0
  123. package/dist/mcp-server/utils/PathUtils.js +178 -0
  124. package/dist/mcp-server/utils/ResponseChunker.d.ts +25 -0
  125. package/dist/mcp-server/utils/ResponseChunker.js +79 -0
  126. package/dist/mcp-server/utils/SharePointErrorHandler.d.ts +34 -0
  127. package/dist/mcp-server/utils/SharePointErrorHandler.js +55 -0
  128. package/dist/schemas/memory-graph-tool-schemas.d.ts +789 -0
  129. package/dist/schemas/memory-graph-tool-schemas.js +181 -0
  130. package/dist/server/ToolRegistry.js +42 -8
  131. package/dist/tools/authorization/ListAuthorizationsTool.js +2 -2
  132. package/dist/tools/authorization/SignOutTool.js +2 -2
  133. package/dist/tools/connections/AccessConnectionTool.js +8 -6
  134. package/dist/tools/connections/CallRemoteToolTool.js +4 -4
  135. package/dist/tools/core/DeleteArtifactTool.js +5 -4
  136. package/dist/tools/core/EditArtifactMetadataTool.js +1 -1
  137. package/dist/tools/core/GetArtifactTool.js +1 -1
  138. package/dist/tools/core/GetArtifactVersionsTool.js +1 -1
  139. package/dist/tools/core/GetChunkTool.js +1 -1
  140. package/dist/tools/core/ListArtifactsTool.js +1 -1
  141. package/dist/tools/core/MoveArtifactTool.js +1 -1
  142. package/dist/tools/core/PublishArtifactFromFileTool.js +1 -1
  143. package/dist/tools/core/PublishArtifactTool.js +2 -2
  144. package/dist/tools/core/SearchArtifactsTool.js +7 -6
  145. package/dist/tools/memory-graph/GraphCreateEntitiesTool.d.ts +11 -0
  146. package/dist/tools/memory-graph/GraphCreateEntitiesTool.js +56 -0
  147. package/dist/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +11 -0
  148. package/dist/tools/memory-graph/GraphCreateRelationshipsTool.js +55 -0
  149. package/dist/tools/memory-graph/GraphCreateTool.d.ts +11 -0
  150. package/dist/tools/memory-graph/GraphCreateTool.js +62 -0
  151. package/dist/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +11 -0
  152. package/dist/tools/memory-graph/GraphDeleteEntitiesTool.js +43 -0
  153. package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +11 -0
  154. package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.js +43 -0
  155. package/dist/tools/memory-graph/GraphExploreTool.d.ts +11 -0
  156. package/dist/tools/memory-graph/GraphExploreTool.js +71 -0
  157. package/dist/tools/memory-graph/GraphFindEntitiesTool.d.ts +11 -0
  158. package/dist/tools/memory-graph/GraphFindEntitiesTool.js +66 -0
  159. package/dist/tools/memory-graph/GraphFindPathsTool.d.ts +11 -0
  160. package/dist/tools/memory-graph/GraphFindPathsTool.js +60 -0
  161. package/dist/tools/memory-graph/GraphGetEntityTool.d.ts +11 -0
  162. package/dist/tools/memory-graph/GraphGetEntityTool.js +47 -0
  163. package/dist/tools/memory-graph/GraphGetRelationshipsTool.d.ts +11 -0
  164. package/dist/tools/memory-graph/GraphGetRelationshipsTool.js +60 -0
  165. package/dist/tools/memory-graph/GraphGetStatsTool.d.ts +11 -0
  166. package/dist/tools/memory-graph/GraphGetStatsTool.js +42 -0
  167. package/dist/tools/memory-graph/GraphListTemplatesTool.d.ts +11 -0
  168. package/dist/tools/memory-graph/GraphListTemplatesTool.js +32 -0
  169. package/dist/tools/memory-graph/GraphListTool.d.ts +11 -0
  170. package/dist/tools/memory-graph/GraphListTool.js +43 -0
  171. package/dist/tools/memory-graph/GraphOpenTool.d.ts +12 -0
  172. package/dist/tools/memory-graph/GraphOpenTool.js +48 -0
  173. package/dist/tools/memory-graph/GraphProposeVocabularyTool.d.ts +11 -0
  174. package/dist/tools/memory-graph/GraphProposeVocabularyTool.js +104 -0
  175. package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.d.ts +11 -0
  176. package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.js +47 -0
  177. package/dist/tools/memory-graph/GraphSearchTool.d.ts +11 -0
  178. package/dist/tools/memory-graph/GraphSearchTool.js +92 -0
  179. package/dist/tools/memory-graph/GraphTraverseTool.d.ts +11 -0
  180. package/dist/tools/memory-graph/GraphTraverseTool.js +112 -0
  181. package/dist/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +11 -0
  182. package/dist/tools/memory-graph/GraphUpdateEntitiesTool.js +56 -0
  183. package/dist/tools/memory-graph/KnowledgeSetListTool.d.ts +11 -0
  184. package/dist/tools/memory-graph/KnowledgeSetListTool.js +23 -0
  185. package/dist/tools/memory-graph/KnowledgeSetOpenTool.d.ts +11 -0
  186. package/dist/tools/memory-graph/KnowledgeSetOpenTool.js +29 -0
  187. package/dist/tools/repository/CreateRepositoryTool.js +10 -9
  188. package/dist/tools/repository/GetRepositoryTool.js +15 -15
  189. package/dist/tools/repository/UpdateRepositoryTool.js +10 -9
  190. package/dist/tools/sharepoint/SharePointListConnectionsTool.js +1 -1
  191. package/dist/tools/sharepoint/SharePointListFoldersTool.js +1 -1
  192. package/dist/tools/utility/AuthorIndexTool.js +6 -5
  193. package/dist/tools/utility/AuthorRecentsTool.js +6 -5
  194. package/dist/tools/utility/HealthCheckController.js +1 -1
  195. package/dist/tools/utility/ListRepositoriesTool.js +5 -4
  196. package/dist/utils/McpErrorHandler.js +1 -1
  197. package/package.json +1 -1
  198. package/package.json.backup +1 -1
@@ -0,0 +1,107 @@
1
+ /**
2
+ * AccessConnectionTool
3
+ * Access a specific external connection, check auth status, and return available tool schemas.
4
+ *
5
+ * Phase 2 of Unified Connection Gateway Implementation
6
+ */
7
+ import { BaseToolController } from '../base/BaseToolController.js';
8
+ import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
9
+ export class AccessConnectionTool extends BaseToolController {
10
+ constructor(ucmClient, logger, publishingAuthorId) {
11
+ super(ucmClient, logger, publishingAuthorId);
12
+ }
13
+ get name() {
14
+ return 'ucm_connection_access';
15
+ }
16
+ get description() {
17
+ return 'Access a specific external connection, check auth status, and return available tool schemas. Call without toolNames to get a summary index of all available tools. Pass toolNames to retrieve full parameter schemas.';
18
+ }
19
+ get inputSchema() {
20
+ return {
21
+ type: 'object',
22
+ properties: {
23
+ connectionId: {
24
+ type: 'string',
25
+ description: 'Connection ID (SharePoint connection or Remote MCP Server) from ucm_connection_list',
26
+ minLength: 36,
27
+ maxLength: 36
28
+ },
29
+ toolNames: {
30
+ type: 'array',
31
+ items: { type: 'string' },
32
+ description: 'Optional list of tool names to get full parameter schemas for. If omitted, returns a summary index of all available tools. Pass in all tool names that could likely be relevant.'
33
+ }
34
+ },
35
+ required: ['connectionId']
36
+ };
37
+ }
38
+ validateParams(params) {
39
+ super.validateParams(params);
40
+ // Validate connectionId
41
+ if (!params.connectionId || typeof params.connectionId !== 'string') {
42
+ throw new McpError(McpErrorCode.InvalidParams, 'connectionId is required and must be a string');
43
+ }
44
+ if (params.connectionId.length !== 36) {
45
+ throw new McpError(McpErrorCode.InvalidParams, 'connectionId must be a valid UUID (36 characters)');
46
+ }
47
+ }
48
+ async handleExecute(params) {
49
+ this.logger.info('AccessConnectionTool', `Accessing connection: ${params.connectionId}`);
50
+ try {
51
+ const result = await this.ucmClient.accessConnection(params.connectionId, params.toolNames);
52
+ this.logger.info('AccessConnectionTool', 'Connection accessed successfully', '', {
53
+ connectionId: params.connectionId,
54
+ connectionType: result.connectionType,
55
+ isAuthenticated: result.isAuthenticated,
56
+ toolCount: result.tools?.length || 0
57
+ });
58
+ // Auth required — return login message
59
+ if (!result.isAuthenticated) {
60
+ if (result.authRequired && result.loginUrl) {
61
+ return `Authentication required for "${result.connectionName}". Login URL: ${result.loginUrl}`;
62
+ }
63
+ return `Connection "${result.connectionName}" is not accessible: ${result.loginMessage || 'Authentication failed'}`;
64
+ }
65
+ // If markdown index returned (no toolNames requested), return markdown
66
+ if (result.markdown) {
67
+ return result.markdown;
68
+ }
69
+ // Tools mode — return compact JSON with schemas
70
+ const json = {
71
+ connectionId: result.connectionId,
72
+ connectionName: result.connectionName,
73
+ instructions: result.instructions,
74
+ policies: result.policies,
75
+ ...(result.error && { error: result.error }),
76
+ tools: result.tools
77
+ };
78
+ return JSON.stringify(json);
79
+ }
80
+ catch (error) {
81
+ // Sanitize error for logging
82
+ const sanitizedError = {
83
+ message: error?.message,
84
+ status: error?.response?.status,
85
+ data: error?.response?.data
86
+ };
87
+ this.logger.error('AccessConnectionTool', 'Failed to access connection', '', sanitizedError);
88
+ if (error instanceof McpError) {
89
+ throw error;
90
+ }
91
+ // Handle API errors
92
+ if (error.response) {
93
+ const status = error.response.status;
94
+ const errorData = error.response.data;
95
+ if (status === 401 || status === 403) {
96
+ throw new McpError(McpErrorCode.InvalidRequest, `Access denied: ${errorData?.message || 'Not authorized to access this connection'}`);
97
+ }
98
+ if (status === 404) {
99
+ throw new McpError(McpErrorCode.InvalidParams, `Connection not found: ${params.connectionId}`);
100
+ }
101
+ throw new McpError(McpErrorCode.InternalError, `API error: ${errorData?.message || error.message}`);
102
+ }
103
+ throw new McpError(McpErrorCode.InternalError, `Failed to access connection: ${error.message}`);
104
+ }
105
+ }
106
+ }
107
+ //# sourceMappingURL=AccessConnectionTool.js.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * CallRemoteToolTool
3
+ * Execute a tool on an external connection (SharePoint or Remote MCP Server).
4
+ *
5
+ * Phase 3 of Unified Connection Gateway Implementation
6
+ */
7
+ import { BaseToolController } from '../base/BaseToolController.js';
8
+ import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
9
+ import { ILogger } from '../../interfaces/ILogger.js';
10
+ export declare class CallRemoteToolTool extends BaseToolController {
11
+ constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
12
+ get name(): string;
13
+ get description(): string;
14
+ get inputSchema(): any;
15
+ protected validateParams(params: any): void;
16
+ protected handleExecute(params: {
17
+ connectionId: string;
18
+ toolName: string;
19
+ args?: any;
20
+ }): Promise<any>;
21
+ }
22
+ //# sourceMappingURL=CallRemoteToolTool.d.ts.map
@@ -0,0 +1,124 @@
1
+ /**
2
+ * CallRemoteToolTool
3
+ * Execute a tool on an external connection (SharePoint or Remote MCP Server).
4
+ *
5
+ * Phase 3 of Unified Connection Gateway Implementation
6
+ */
7
+ import { BaseToolController } from '../base/BaseToolController.js';
8
+ import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
9
+ export class CallRemoteToolTool extends BaseToolController {
10
+ constructor(ucmClient, logger, publishingAuthorId) {
11
+ super(ucmClient, logger, publishingAuthorId);
12
+ }
13
+ get name() {
14
+ return 'ucm_connection_call_tool';
15
+ }
16
+ get description() {
17
+ return 'Call a tool on an external connection.';
18
+ }
19
+ get inputSchema() {
20
+ return {
21
+ type: 'object',
22
+ properties: {
23
+ connectionId: {
24
+ type: 'string',
25
+ description: 'Connection ID (SharePoint connection or Remote MCP Server) from ucm_connection_list',
26
+ minLength: 36,
27
+ maxLength: 36
28
+ },
29
+ toolName: {
30
+ type: 'string',
31
+ description: 'Name of the tool to call (see ucm_connection_access for available tools)',
32
+ minLength: 1
33
+ },
34
+ args: {
35
+ type: 'object',
36
+ description: 'Tool arguments — passed through to the remote tool as-is',
37
+ additionalProperties: true
38
+ }
39
+ },
40
+ required: ['connectionId', 'toolName']
41
+ };
42
+ }
43
+ validateParams(params) {
44
+ super.validateParams(params);
45
+ // Validate connectionId
46
+ if (!params.connectionId || typeof params.connectionId !== 'string') {
47
+ throw new McpError(McpErrorCode.InvalidParams, 'connectionId is required and must be a string');
48
+ }
49
+ if (params.connectionId.length !== 36) {
50
+ throw new McpError(McpErrorCode.InvalidParams, 'connectionId must be a valid UUID (36 characters)');
51
+ }
52
+ // Validate toolName
53
+ if (!params.toolName || typeof params.toolName !== 'string') {
54
+ throw new McpError(McpErrorCode.InvalidParams, 'toolName is required and must be a string');
55
+ }
56
+ }
57
+ async handleExecute(params) {
58
+ // MCP transport may serialize nested objects as strings — parse if needed
59
+ const args = typeof params.args === 'string'
60
+ ? JSON.parse(params.args)
61
+ : params.args;
62
+ this.logger.info('CallRemoteToolTool', `Calling tool ${params.toolName} on connection: ${params.connectionId}`);
63
+ try {
64
+ const result = await this.ucmClient.callRemoteTool(params.connectionId, params.toolName, args);
65
+ this.logger.info('CallRemoteToolTool', 'Tool executed successfully', '', {
66
+ connectionId: params.connectionId,
67
+ toolName: params.toolName,
68
+ success: result.success,
69
+ authRequired: result.authRequired || false
70
+ });
71
+ // Clean proxy: pass through content blocks directly
72
+ // Return structured JSON for errors so the AI can self-correct and retry
73
+ if (!result.success) {
74
+ if (result.errorCode === 'TOOL_NOT_FOUND' && result.tools) {
75
+ return JSON.stringify({
76
+ error: 'TOOL_NOT_FOUND',
77
+ message: result.error,
78
+ available_tools: result.tools
79
+ });
80
+ }
81
+ if (result.errorCode === 'VALIDATION_ERROR' && result.tools) {
82
+ return JSON.stringify({
83
+ error: 'VALIDATION_ERROR',
84
+ message: result.error,
85
+ tool_schema: result.tools[0]
86
+ });
87
+ }
88
+ // For other errors (auth), return text
89
+ return result.markdown || result.error || 'Tool execution failed';
90
+ }
91
+ // Return as pre-formatted MCP response — McpHandler will pass through
92
+ return { content: result.content };
93
+ }
94
+ catch (error) {
95
+ // Sanitize error for logging
96
+ const sanitizedError = {
97
+ message: error?.message,
98
+ status: error?.response?.status,
99
+ data: error?.response?.data
100
+ };
101
+ this.logger.error('CallRemoteToolTool', 'Failed to execute tool', '', sanitizedError);
102
+ if (error instanceof McpError) {
103
+ throw error;
104
+ }
105
+ // Handle API errors
106
+ if (error.response) {
107
+ const status = error.response.status;
108
+ const errorData = error.response.data;
109
+ if (status === 401 || status === 403) {
110
+ throw new McpError(McpErrorCode.InvalidRequest, `Access denied: ${errorData?.message || 'Not authorized to access this connection'}`);
111
+ }
112
+ if (status === 404) {
113
+ throw new McpError(McpErrorCode.InvalidParams, `Connection not found: ${params.connectionId}`);
114
+ }
115
+ if (status === 400) {
116
+ throw new McpError(McpErrorCode.InvalidParams, `Invalid request: ${errorData?.message || errorData?.error || 'Invalid parameters'}`);
117
+ }
118
+ throw new McpError(McpErrorCode.InternalError, `API error: ${errorData?.message || error.message}`);
119
+ }
120
+ throw new McpError(McpErrorCode.InternalError, `Failed to execute tool: ${error.message}`);
121
+ }
122
+ }
123
+ }
124
+ //# sourceMappingURL=CallRemoteToolTool.js.map
@@ -0,0 +1,11 @@
1
+ import { BaseToolController } from '../base/BaseToolController.js';
2
+ import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
3
+ import { ILogger } from '../../interfaces/ILogger.js';
4
+ export declare class DeleteArtifactTool extends BaseToolController {
5
+ constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
6
+ get name(): string;
7
+ get description(): string;
8
+ get inputSchema(): any;
9
+ protected handleExecute(params: any): Promise<any>;
10
+ }
11
+ //# sourceMappingURL=DeleteArtifactTool.d.ts.map
@@ -0,0 +1,83 @@
1
+ import { BaseToolController } from '../base/BaseToolController.js';
2
+ export class DeleteArtifactTool extends BaseToolController {
3
+ constructor(ucmClient, logger, publishingAuthorId) {
4
+ super(ucmClient, logger, publishingAuthorId);
5
+ }
6
+ get name() {
7
+ return 'ucm_artifact_delete';
8
+ }
9
+ get description() {
10
+ return 'Delete a UCM artifact by path and version. This action cannot be undone. Only the latest or specified version is deleted.';
11
+ }
12
+ get inputSchema() {
13
+ return {
14
+ type: 'object',
15
+ properties: {
16
+ workspace: {
17
+ type: 'string',
18
+ description: `Author name (e.g., ${this.publishingAuthorId || '01234567890'})`,
19
+ minLength: 1,
20
+ maxLength: 50
21
+ },
22
+ repository: {
23
+ type: 'string',
24
+ description: 'Repository name (e.g., "main")',
25
+ minLength: 1,
26
+ maxLength: 50
27
+ },
28
+ category: {
29
+ type: 'string',
30
+ description: 'Category name (e.g., "commands")',
31
+ minLength: 1,
32
+ maxLength: 50
33
+ },
34
+ subcategory: {
35
+ type: 'string',
36
+ description: 'Subcategory name (e.g., "user")',
37
+ minLength: 1,
38
+ maxLength: 50
39
+ },
40
+ filename: {
41
+ type: 'string',
42
+ description: 'Filename with optional version suffix (e.g., "CreateUserCommand.ts" or "CreateUserCommand.ts@1.0.0")',
43
+ minLength: 1,
44
+ maxLength: 150
45
+ }
46
+ },
47
+ required: ['workspace', 'repository', 'category', 'subcategory', 'filename']
48
+ };
49
+ }
50
+ async handleExecute(params) {
51
+ const { workspace, repository, category, subcategory, filename } = params;
52
+ const author = workspace;
53
+ this.logger.debug('DeleteArtifactTool', `Deleting artifact: ${author}/${repository}/${category}/${subcategory}/${filename}`);
54
+ try {
55
+ // Parse filename to extract version if present
56
+ const parts = filename.split('@');
57
+ const actualFilename = parts[0];
58
+ const version = parts.length > 1 ? parts[1] : undefined;
59
+ // Delete artifact from API and capture the response
60
+ const deleteResponse = await this.ucmClient.deleteArtifact(author, repository, category, subcategory, actualFilename, version);
61
+ const path = `${author}/${repository}/${category}/${subcategory}/${filename}`;
62
+ this.logger.info('DeleteArtifactTool', `Artifact deleted successfully: ${path}`);
63
+ // Use actual response data from the server instead of hardcoded values
64
+ return {
65
+ success: deleteResponse.success || true,
66
+ message: `Artifact deleted successfully`,
67
+ author,
68
+ repository,
69
+ category,
70
+ subcategory,
71
+ filename: deleteResponse.filename || actualFilename,
72
+ version: deleteResponse.version, // Use actual version that was deleted from server
73
+ path,
74
+ deletedAt: deleteResponse.deletedAt || new Date().toISOString()
75
+ };
76
+ }
77
+ catch (error) {
78
+ this.logger.error('DeleteArtifactTool', `Failed to delete artifact: ${author}/${repository}/${category}/${subcategory}/${filename}`, '', error);
79
+ throw error;
80
+ }
81
+ }
82
+ }
83
+ //# sourceMappingURL=DeleteArtifactTool.js.map
@@ -0,0 +1,12 @@
1
+ import { BaseToolController } from '../base/BaseToolController.js';
2
+ import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
3
+ import { ILogger } from '../../interfaces/ILogger.js';
4
+ export declare class EditArtifactMetadataTool extends BaseToolController {
5
+ constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
6
+ get name(): string;
7
+ get description(): string;
8
+ get inputSchema(): any;
9
+ protected handleExecute(params: any): Promise<any>;
10
+ protected validateParams(params: any): void;
11
+ }
12
+ //# sourceMappingURL=EditArtifactMetadataTool.d.ts.map
@@ -0,0 +1,173 @@
1
+ import { BaseToolController } from '../base/BaseToolController.js';
2
+ import { parsePath } from '../../utils/PathUtils.js';
3
+ import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
4
+ export class EditArtifactMetadataTool extends BaseToolController {
5
+ constructor(ucmClient, logger, publishingAuthorId) {
6
+ super(ucmClient, logger, publishingAuthorId);
7
+ }
8
+ get name() {
9
+ return 'ucm_artifact_edit_metadata';
10
+ }
11
+ get description() {
12
+ return 'Edit artifact metadata and move artifacts. Supports updating description, namespace, filename, MIME type, technology, and tags. Move operations affect all versions while metadata-only updates apply to latest version only.';
13
+ }
14
+ get inputSchema() {
15
+ return {
16
+ type: 'object',
17
+ properties: {
18
+ path: {
19
+ type: 'string',
20
+ description: `Full artifact path (e.g., "${this.publishingAuthorId || '1234567890'}/main/commands/user/CreateUserCommand.ts")`,
21
+ minLength: 1,
22
+ maxLength: 250
23
+ },
24
+ updateDescription: {
25
+ type: 'string',
26
+ description: 'New description for the artifact (up to 1000 characters)',
27
+ maxLength: 1000
28
+ },
29
+ updateNamespace: {
30
+ type: 'string',
31
+ description: 'New namespace path to move artifact to (e.g., "utaba/main/services/user")',
32
+ maxLength: 200
33
+ },
34
+ updateFilename: {
35
+ type: 'string',
36
+ description: 'New filename for the artifact (e.g., "UserService.ts")',
37
+ maxLength: 100
38
+ },
39
+ updateMimeType: {
40
+ type: 'string',
41
+ description: 'New MIME type for the artifact (e.g., "application/typescript")',
42
+ maxLength: 100
43
+ },
44
+ updateTechnology: {
45
+ type: 'string',
46
+ description: 'New technology stack (e.g., "typescript", "python", "nextjs")',
47
+ maxLength: 50
48
+ },
49
+ updateTags: {
50
+ type: 'string',
51
+ description: 'New comma-separated tags for categorization',
52
+ maxLength: 500
53
+ }
54
+ },
55
+ required: ['path'],
56
+ additionalProperties: false
57
+ };
58
+ }
59
+ async handleExecute(params) {
60
+ const { path, updateDescription, updateNamespace, updateFilename, updateMimeType, updateTechnology, updateTags } = params;
61
+ this.logger.debug('EditArtifactMetadataTool', `Editing artifact metadata: ${path}`, '', {
62
+ hasDescriptionUpdate: !!updateDescription,
63
+ hasNamespaceUpdate: !!updateNamespace,
64
+ hasFilenameUpdate: !!updateFilename
65
+ });
66
+ try {
67
+ // Parse the current path to extract components
68
+ const pathComponents = parsePath(path);
69
+ // Validate path components exist including repository
70
+ if (!pathComponents.author || !pathComponents.repository || !pathComponents.category || !pathComponents.subcategory || !pathComponents.filename) {
71
+ throw new McpError(McpErrorCode.InvalidParams, 'Path must contain author, repository, category, subcategory, and filename (e.g., "utaba/main/commands/user/CreateUserCommand.ts")');
72
+ }
73
+ // Validate that at least one update field is provided
74
+ const hasUpdates = !!(updateDescription || updateNamespace || updateFilename || updateMimeType || updateTechnology || updateTags);
75
+ if (!hasUpdates) {
76
+ throw new McpError(McpErrorCode.InvalidParams, 'At least one update field must be provided (updateDescription, updateNamespace, updateFilename, updateMimeType, updateTechnology, or updateTags)');
77
+ }
78
+ // Prepare the edit data
79
+ const editData = {};
80
+ if (updateDescription !== undefined)
81
+ editData.updateDescription = updateDescription;
82
+ if (updateNamespace !== undefined)
83
+ editData.updateNamespace = updateNamespace;
84
+ if (updateFilename !== undefined)
85
+ editData.updateFilename = updateFilename;
86
+ if (updateMimeType !== undefined)
87
+ editData.updateMimeType = updateMimeType;
88
+ if (updateTechnology !== undefined)
89
+ editData.updateTechnology = updateTechnology;
90
+ if (updateTags !== undefined)
91
+ editData.updateTags = updateTags;
92
+ // Call the API to edit the artifact metadata
93
+ const result = await this.ucmClient.editArtifactMetadata(pathComponents.author, pathComponents.repository, pathComponents.category, pathComponents.subcategory, pathComponents.filename, editData);
94
+ // Handle response structure - API might return wrapped in 'data' or direct
95
+ const responseData = result.data || result;
96
+ // Build successful response with operation details
97
+ const isMove = !!(updateNamespace || updateFilename);
98
+ const operation = isMove ? 'move' : 'metadata_update';
99
+ const response = {
100
+ success: true,
101
+ operation,
102
+ artifact: {
103
+ originalPath: path,
104
+ newPath: isMove ?
105
+ `${updateNamespace || `${pathComponents.author}/${pathComponents.repository}/${pathComponents.category}/${pathComponents.subcategory}`}/${updateFilename || pathComponents.filename}` :
106
+ path,
107
+ updatedFields: Object.keys(editData),
108
+ affectedVersions: responseData.affectedVersions || (isMove ? 'all' : 'latest'),
109
+ },
110
+ details: responseData.details || 'Artifact metadata updated successfully',
111
+ _links: responseData._links || {}
112
+ };
113
+ this.logger.info('EditArtifactMetadataTool', `Artifact edited successfully: ${path}`, '', {
114
+ operation,
115
+ updatedFields: Object.keys(editData),
116
+ affectedVersions: response.artifact.affectedVersions
117
+ });
118
+ return response;
119
+ }
120
+ catch (error) {
121
+ this.logger.error('EditArtifactMetadataTool', `Failed to edit artifact: ${path}`, '', error);
122
+ // Enhanced error handling for edit operations
123
+ const errorMessage = error instanceof Error ? error.message : String(error);
124
+ if (errorMessage?.includes('not found')) {
125
+ throw new McpError(McpErrorCode.InvalidParams, `Artifact not found at path: ${path}. Please verify the path is correct and the artifact exists.`);
126
+ }
127
+ if (errorMessage?.includes('permission') || errorMessage?.includes('unauthorized')) {
128
+ throw new McpError(McpErrorCode.InvalidParams, `Insufficient permissions to edit artifact at: ${path}. You must have write access to both source and destination namespaces for move operations.`);
129
+ }
130
+ if (errorMessage?.includes('destination already exists')) {
131
+ throw new McpError(McpErrorCode.InvalidParams, 'Destination artifact already exists. Choose a different filename or namespace for move operations.');
132
+ }
133
+ if (errorMessage?.includes('Invalid namespace format')) {
134
+ throw new McpError(McpErrorCode.InvalidParams, `Invalid namespace format in updateNamespace. Must follow pattern "author/repository/category/subcategory". Example: "${this.publishingAuthorId || '0000000000'}/main/services/user"`);
135
+ }
136
+ if (errorMessage?.includes('Author not found')) {
137
+ throw new McpError(McpErrorCode.InvalidParams, `Author not found. Ensure the path uses a valid author identifier.`);
138
+ }
139
+ throw error;
140
+ }
141
+ }
142
+ validateParams(params) {
143
+ super.validateParams(params);
144
+ const { path, updateNamespace, updateFilename, updateDescription } = params;
145
+ // Validate path format
146
+ if (!path || typeof path !== 'string') {
147
+ throw new McpError(McpErrorCode.InvalidParams, 'path is required and must be a string');
148
+ }
149
+ // Basic path validation - should contain at least author/repository/category/subcategory/filename
150
+ const pathParts = path.split('/');
151
+ if (pathParts.length < 5) {
152
+ throw new McpError(McpErrorCode.InvalidParams, 'path must contain at least author/repository/category/subcategory/filename');
153
+ }
154
+ // Validate updateNamespace format if provided
155
+ if (updateNamespace && updateNamespace.length > 0) {
156
+ const namespaceParts = updateNamespace.split('/');
157
+ if (namespaceParts.length !== 4) {
158
+ throw new McpError(McpErrorCode.InvalidParams, 'updateNamespace must follow format "author/repository/category/subcategory"');
159
+ }
160
+ }
161
+ // Validate updateFilename if provided
162
+ if (updateFilename && updateFilename.length > 0) {
163
+ if (!/^[^\/\\:*?"<>|]+\.[a-zA-Z0-9]+$/.test(updateFilename)) {
164
+ throw new McpError(McpErrorCode.InvalidParams, 'updateFilename must be a valid filename with extension (e.g., "UserService.ts")');
165
+ }
166
+ }
167
+ // Validate description length
168
+ if (updateDescription && updateDescription.length > 1000) {
169
+ throw new McpError(McpErrorCode.InvalidParams, 'updateDescription cannot exceed 1000 characters');
170
+ }
171
+ }
172
+ }
173
+ //# sourceMappingURL=EditArtifactMetadataTool.js.map
@@ -0,0 +1,13 @@
1
+ import { BaseToolController } from '../base/BaseToolController.js';
2
+ import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
3
+ import { ILogger } from '../../interfaces/ILogger.js';
4
+ export declare class GetArtifactTool extends BaseToolController {
5
+ private trustedAuthors;
6
+ constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string, trustedAuthors?: string[]);
7
+ get name(): string;
8
+ get description(): string;
9
+ get inputSchema(): any;
10
+ protected handleExecute(params: any): Promise<any>;
11
+ private detectMimeType;
12
+ }
13
+ //# sourceMappingURL=GetArtifactTool.d.ts.map