@utaba/ucm-mcp-server 6.6.0 → 6.7.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.
- package/dist/clients/UcmLocalApiClient.d.ts +48 -1
- package/dist/clients/UcmLocalApiClient.js +8 -0
- package/dist/index.js +1 -1
- package/dist/interfaces/IMcpTool.d.ts +2 -2
- package/dist/server/ToolRegistry.js +2 -0
- package/dist/tools/base/BaseToolController.d.ts +7 -4
- package/dist/tools/base/BaseToolController.js +28 -11
- package/dist/tools/core/MoveArtifactTool.d.ts +1 -1
- package/dist/tools/core/MoveArtifactTool.js +1 -1
- package/dist/tools/memory-graph/GraphCreateEntitiesTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphCreateEntitiesTool.js +2 -0
- package/dist/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphCreateRelationshipsTool.js +2 -0
- package/dist/tools/memory-graph/GraphCreateTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphCreateTool.js +2 -0
- package/dist/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphDeleteEntitiesTool.js +2 -0
- package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.js +2 -0
- package/dist/tools/memory-graph/GraphExploreTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphExploreTool.js +2 -0
- package/dist/tools/memory-graph/GraphFindEntitiesTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphFindEntitiesTool.js +2 -0
- package/dist/tools/memory-graph/GraphFindPathsTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphFindPathsTool.js +2 -0
- package/dist/tools/memory-graph/GraphGetEntityTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphGetEntityTool.js +2 -0
- package/dist/tools/memory-graph/GraphGetRelationshipsTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphGetRelationshipsTool.js +2 -0
- package/dist/tools/memory-graph/GraphListTemplatesTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphListTemplatesTool.js +2 -0
- package/dist/tools/memory-graph/GraphListTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphListTool.js +2 -0
- package/dist/tools/memory-graph/GraphOpenTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphOpenTool.js +3 -1
- package/dist/tools/memory-graph/GraphProposeVocabularyTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphProposeVocabularyTool.js +51 -6
- package/dist/tools/memory-graph/GraphSearchTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphSearchTool.js +2 -0
- package/dist/tools/memory-graph/GraphTraverseTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphTraverseTool.js +2 -0
- package/dist/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +5 -2
- package/dist/tools/memory-graph/GraphUpdateEntitiesTool.js +2 -0
- package/dist/{mcp-server/tools/memory-graph/GraphSearchTool.d.ts → tools/memory-graph/GraphUpdateTool.d.ts} +4 -4
- package/dist/tools/memory-graph/GraphUpdateTool.js +59 -0
- package/dist/tools/memory-graph/KnowledgeSetListTool.d.ts +5 -2
- package/dist/tools/memory-graph/KnowledgeSetListTool.js +2 -0
- package/dist/tools/memory-graph/KnowledgeSetOpenTool.d.ts +5 -2
- package/dist/tools/memory-graph/KnowledgeSetOpenTool.js +2 -0
- package/package.json +1 -1
- package/package.json.backup +1 -1
- package/dist/clients/UcmApiClient.d.ts +0 -157
- package/dist/clients/UcmApiClient.js +0 -443
- package/dist/mcp-server/clients/UcmLocalApiClient.d.ts +0 -399
- package/dist/mcp-server/clients/UcmLocalApiClient.js +0 -719
- package/dist/mcp-server/index.d.ts +0 -3
- package/dist/mcp-server/index.js +0 -68
- package/dist/mcp-server/interfaces/ILogger.d.ts +0 -8
- package/dist/mcp-server/interfaces/ILogger.js +0 -4
- package/dist/mcp-server/interfaces/IMcpTool.d.ts +0 -7
- package/dist/mcp-server/interfaces/IMcpTool.js +0 -3
- package/dist/mcp-server/logging/ConsoleLogger.d.ts +0 -16
- package/dist/mcp-server/logging/ConsoleLogger.js +0 -45
- package/dist/mcp-server/logging/LoggerFactory.d.ts +0 -9
- package/dist/mcp-server/logging/LoggerFactory.js +0 -12
- package/dist/mcp-server/server/McpConfig.d.ts +0 -26
- package/dist/mcp-server/server/McpConfig.js +0 -90
- package/dist/mcp-server/server/McpHandler.d.ts +0 -12
- package/dist/mcp-server/server/McpHandler.js +0 -84
- package/dist/mcp-server/server/McpServer.d.ts +0 -15
- package/dist/mcp-server/server/McpServer.js +0 -49
- package/dist/mcp-server/server/ToolRegistry.d.ts +0 -23
- package/dist/mcp-server/server/ToolRegistry.js +0 -169
- package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.d.ts +0 -21
- package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.js +0 -146
- package/dist/mcp-server/tools/authorization/SignOutTool.d.ts +0 -23
- package/dist/mcp-server/tools/authorization/SignOutTool.js +0 -128
- package/dist/mcp-server/tools/base/BaseToolController.d.ts +0 -19
- package/dist/mcp-server/tools/base/BaseToolController.js +0 -58
- package/dist/mcp-server/tools/connections/AccessConnectionTool.d.ts +0 -21
- package/dist/mcp-server/tools/connections/AccessConnectionTool.js +0 -107
- package/dist/mcp-server/tools/connections/CallRemoteToolTool.d.ts +0 -22
- package/dist/mcp-server/tools/connections/CallRemoteToolTool.js +0 -124
- package/dist/mcp-server/tools/core/DeleteArtifactTool.d.ts +0 -11
- package/dist/mcp-server/tools/core/DeleteArtifactTool.js +0 -83
- package/dist/mcp-server/tools/core/EditArtifactMetadataTool.d.ts +0 -12
- package/dist/mcp-server/tools/core/EditArtifactMetadataTool.js +0 -173
- package/dist/mcp-server/tools/core/GetArtifactTool.d.ts +0 -13
- package/dist/mcp-server/tools/core/GetArtifactTool.js +0 -124
- package/dist/mcp-server/tools/core/GetArtifactVersionsTool.d.ts +0 -11
- package/dist/mcp-server/tools/core/GetArtifactVersionsTool.js +0 -63
- package/dist/mcp-server/tools/core/GetChunkTool.d.ts +0 -11
- package/dist/mcp-server/tools/core/GetChunkTool.js +0 -56
- package/dist/mcp-server/tools/core/ListArtifactsTool.d.ts +0 -11
- package/dist/mcp-server/tools/core/ListArtifactsTool.js +0 -84
- package/dist/mcp-server/tools/core/MoveArtifactTool.d.ts +0 -12
- package/dist/mcp-server/tools/core/MoveArtifactTool.js +0 -104
- package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.d.ts +0 -15
- package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.js +0 -277
- package/dist/mcp-server/tools/core/PublishArtifactTool.d.ts +0 -13
- package/dist/mcp-server/tools/core/PublishArtifactTool.js +0 -218
- package/dist/mcp-server/tools/core/SearchArtifactsTool.d.ts +0 -11
- package/dist/mcp-server/tools/core/SearchArtifactsTool.js +0 -137
- package/dist/mcp-server/tools/list/ListNamespaceController.d.ts +0 -1
- package/dist/mcp-server/tools/list/ListNamespaceController.js +0 -8
- package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.js +0 -58
- package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.js +0 -57
- package/dist/mcp-server/tools/memory-graph/GraphCreateTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphCreateTool.js +0 -64
- package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.js +0 -45
- package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.js +0 -45
- package/dist/mcp-server/tools/memory-graph/GraphExploreTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphExploreTool.js +0 -73
- package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.js +0 -68
- package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.js +0 -62
- package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.js +0 -49
- package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.js +0 -62
- package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.js +0 -34
- package/dist/mcp-server/tools/memory-graph/GraphListTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphListTool.js +0 -45
- package/dist/mcp-server/tools/memory-graph/GraphOpenTool.d.ts +0 -15
- package/dist/mcp-server/tools/memory-graph/GraphOpenTool.js +0 -50
- package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.js +0 -108
- package/dist/mcp-server/tools/memory-graph/GraphSearchTool.js +0 -94
- package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.js +0 -114
- package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.js +0 -58
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.js +0 -25
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.d.ts +0 -14
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.js +0 -31
- package/dist/mcp-server/tools/repository/CreateRepositoryTool.d.ts +0 -12
- package/dist/mcp-server/tools/repository/CreateRepositoryTool.js +0 -116
- package/dist/mcp-server/tools/repository/GetRepositoryTool.d.ts +0 -12
- package/dist/mcp-server/tools/repository/GetRepositoryTool.js +0 -85
- package/dist/mcp-server/tools/repository/UpdateRepositoryTool.d.ts +0 -12
- package/dist/mcp-server/tools/repository/UpdateRepositoryTool.js +0 -115
- package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.d.ts +0 -19
- package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.js +0 -90
- package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.d.ts +0 -21
- package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.js +0 -133
- package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.d.ts +0 -22
- package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.js +0 -146
- package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.d.ts +0 -18
- package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.js +0 -108
- package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.d.ts +0 -22
- package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.js +0 -125
- package/dist/mcp-server/tools/utility/AuthorIndexTool.d.ts +0 -11
- package/dist/mcp-server/tools/utility/AuthorIndexTool.js +0 -49
- package/dist/mcp-server/tools/utility/AuthorRecentsTool.d.ts +0 -11
- package/dist/mcp-server/tools/utility/AuthorRecentsTool.js +0 -49
- package/dist/mcp-server/tools/utility/ListRepositoriesTool.d.ts +0 -11
- package/dist/mcp-server/tools/utility/ListRepositoriesTool.js +0 -68
- package/dist/mcp-server/tools/utility/QuickstartTool.d.ts +0 -11
- package/dist/mcp-server/tools/utility/QuickstartTool.js +0 -36
- package/dist/mcp-server/types/UcmApiTypes.d.ts +0 -40
- package/dist/mcp-server/types/UcmApiTypes.js +0 -4
- package/dist/mcp-server/utils/McpErrorHandler.d.ts +0 -25
- package/dist/mcp-server/utils/McpErrorHandler.js +0 -67
- package/dist/mcp-server/utils/PathUtils.d.ts +0 -61
- package/dist/mcp-server/utils/PathUtils.js +0 -178
- package/dist/mcp-server/utils/ResponseChunker.d.ts +0 -25
- package/dist/mcp-server/utils/ResponseChunker.js +0 -79
- package/dist/mcp-server/utils/SharePointErrorHandler.d.ts +0 -34
- package/dist/mcp-server/utils/SharePointErrorHandler.js +0 -55
- package/dist/publish/package.json +0 -37
- package/dist/schemas/memory-graph-tool-schemas.d.ts +0 -789
- package/dist/schemas/memory-graph-tool-schemas.js +0 -181
- package/dist/tools/artifacts/GetArtifactController.d.ts +0 -34
- package/dist/tools/artifacts/GetArtifactController.js +0 -397
- package/dist/tools/artifacts/GetLatestController.d.ts +0 -39
- package/dist/tools/artifacts/GetLatestController.js +0 -469
- package/dist/tools/artifacts/ListVersionsController.d.ts +0 -43
- package/dist/tools/artifacts/ListVersionsController.js +0 -530
- package/dist/tools/artifacts/PublishArtifactController.d.ts +0 -37
- package/dist/tools/artifacts/PublishArtifactController.js +0 -605
- package/dist/tools/discovery/BrowseCategoriesController.d.ts +0 -25
- package/dist/tools/discovery/BrowseCategoriesController.js +0 -400
- package/dist/tools/discovery/FindByPurposeController.d.ts +0 -12
- package/dist/tools/discovery/FindByPurposeController.js +0 -131
- package/dist/tools/discovery/ListAuthorsController.d.ts +0 -20
- package/dist/tools/discovery/ListAuthorsController.js +0 -274
- package/dist/tools/discovery/SearchArtifactsController.d.ts +0 -14
- package/dist/tools/discovery/SearchArtifactsController.js +0 -226
- package/dist/tools/memory-graph/GraphGetStatsTool.d.ts +0 -11
- package/dist/tools/memory-graph/GraphGetStatsTool.js +0 -42
- package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.d.ts +0 -11
- package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.js +0 -47
- package/dist/tools/navigation/ExploreNamespaceController.d.ts +0 -35
- package/dist/tools/navigation/ExploreNamespaceController.js +0 -548
- package/dist/tools/repository/DeleteRepositoryGuidanceTool.d.ts +0 -13
- package/dist/tools/repository/DeleteRepositoryGuidanceTool.js +0 -93
- package/dist/tools/sharepoint/SharePointSignOutTool.d.ts +0 -22
- package/dist/tools/sharepoint/SharePointSignOutTool.js +0 -114
- package/dist/tools/utility/HealthCheckController.d.ts +0 -11
- package/dist/tools/utility/HealthCheckController.js +0 -60
- package/dist/tools/utility/SubmitFeedbackTool.d.ts +0 -16
- package/dist/tools/utility/SubmitFeedbackTool.js +0 -68
- package/dist/tools/utility/ValidatePathController.d.ts +0 -30
- package/dist/tools/utility/ValidatePathController.js +0 -465
- package/dist/utils/HttpsAgentFactory.d.ts +0 -21
- package/dist/utils/HttpsAgentFactory.js +0 -50
- package/dist/utils/ValidationUtils.d.ts +0 -10
- package/dist/utils/ValidationUtils.js +0 -50
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SharePointListFoldersTool
|
|
3
|
-
* List folders in SharePoint document library
|
|
4
|
-
*/
|
|
5
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
-
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
7
|
-
import { SharePointErrorHandler } from '../../utils/SharePointErrorHandler.js';
|
|
8
|
-
export class SharePointListFoldersTool extends BaseToolController {
|
|
9
|
-
constructor(ucmClient, logger, publishingAuthorId) {
|
|
10
|
-
super(ucmClient, logger, publishingAuthorId);
|
|
11
|
-
}
|
|
12
|
-
get name() {
|
|
13
|
-
return 'ucm_sharepoint_list_folders';
|
|
14
|
-
}
|
|
15
|
-
get description() {
|
|
16
|
-
return 'Browse SharePoint hierarchically: "/" lists document libraries, "/LibraryName" lists library root, "/LibraryName/Folder" lists subfolder. Supports pagination. Use ucm_connection_list first to get connection ID.';
|
|
17
|
-
}
|
|
18
|
-
get inputSchema() {
|
|
19
|
-
return {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
connectionId: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
description: 'SharePoint connection ID to use for listing folders (get this from list_connections)',
|
|
25
|
-
minLength: 36,
|
|
26
|
-
maxLength: 36
|
|
27
|
-
},
|
|
28
|
-
folderPath: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
description: 'Path: "/" = list libraries (e.g., Documents, Sales), "/Documents" = list library root, "/Documents/Projects" = list subfolder. Default: "/"',
|
|
31
|
-
maxLength: 1000
|
|
32
|
-
},
|
|
33
|
-
limit: {
|
|
34
|
-
type: 'number',
|
|
35
|
-
description: 'Maximum number of items to return (default: 50, max: 200)',
|
|
36
|
-
minimum: 1,
|
|
37
|
-
maximum: 200
|
|
38
|
-
},
|
|
39
|
-
offset: {
|
|
40
|
-
type: 'number',
|
|
41
|
-
description: 'Number of items to skip for pagination (default: 0)',
|
|
42
|
-
minimum: 0
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
required: ['connectionId'],
|
|
46
|
-
additionalProperties: false
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
validateParams(params) {
|
|
50
|
-
super.validateParams(params);
|
|
51
|
-
// Validate connectionId is UUID format
|
|
52
|
-
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
53
|
-
if (!uuidPattern.test(params.connectionId)) {
|
|
54
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Connection ID must be a valid UUID');
|
|
55
|
-
}
|
|
56
|
-
// Set default folder path if not provided
|
|
57
|
-
if (!params.folderPath) {
|
|
58
|
-
params.folderPath = '/';
|
|
59
|
-
}
|
|
60
|
-
// Validate folder path format
|
|
61
|
-
if (params.folderPath && typeof params.folderPath !== 'string') {
|
|
62
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Folder path must be a string');
|
|
63
|
-
}
|
|
64
|
-
// Ensure folder path starts with /
|
|
65
|
-
if (params.folderPath && !params.folderPath.startsWith('/')) {
|
|
66
|
-
params.folderPath = '/' + params.folderPath;
|
|
67
|
-
}
|
|
68
|
-
// Validate and set default limit
|
|
69
|
-
if (params.limit !== undefined) {
|
|
70
|
-
if (typeof params.limit !== 'number' || params.limit < 1 || params.limit > 200) {
|
|
71
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Limit must be between 1 and 200');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
params.limit = 50;
|
|
76
|
-
}
|
|
77
|
-
// Validate and set default offset
|
|
78
|
-
if (params.offset !== undefined) {
|
|
79
|
-
if (typeof params.offset !== 'number' || params.offset < 0) {
|
|
80
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Offset must be 0 or greater');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
params.offset = 0;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async handleExecute(params) {
|
|
88
|
-
this.logger.info('SharePointListFoldersTool', `Listing folders at path: ${params.folderPath}`);
|
|
89
|
-
try {
|
|
90
|
-
// Call the API to list SharePoint folders
|
|
91
|
-
// organizationId is auto-detected from auth token in V1 API
|
|
92
|
-
const listParams = {
|
|
93
|
-
folderPath: params.folderPath,
|
|
94
|
-
limit: params.limit,
|
|
95
|
-
offset: params.offset
|
|
96
|
-
};
|
|
97
|
-
// Make API call via UCM client (V1 API)
|
|
98
|
-
const result = await this.ucmClient.sharePointListFolders(params.connectionId, listParams);
|
|
99
|
-
this.logger.info('SharePointListFoldersTool', `Listed ${result.folders?.length || 0} folders and ${result.files?.length || 0} files`);
|
|
100
|
-
// Format response from V1 API
|
|
101
|
-
const response = {
|
|
102
|
-
success: true,
|
|
103
|
-
path: result.path || params.folderPath,
|
|
104
|
-
totalFolders: result.totalFolders || 0,
|
|
105
|
-
totalFiles: result.totalFiles || 0,
|
|
106
|
-
total: result.total || 0,
|
|
107
|
-
hasMore: result.hasMore || false,
|
|
108
|
-
limit: params.limit,
|
|
109
|
-
offset: params.offset,
|
|
110
|
-
folders: result.folders?.map((folder) => ({
|
|
111
|
-
name: folder.name,
|
|
112
|
-
webUrl: folder.webUrl,
|
|
113
|
-
size: folder.size,
|
|
114
|
-
createdDateTime: folder.createdDateTime,
|
|
115
|
-
lastModifiedDateTime: folder.lastModifiedDateTime
|
|
116
|
-
})) || [],
|
|
117
|
-
files: result.files || []
|
|
118
|
-
};
|
|
119
|
-
return {
|
|
120
|
-
content: [
|
|
121
|
-
{
|
|
122
|
-
type: 'text',
|
|
123
|
-
text: JSON.stringify(response, null, 2)
|
|
124
|
-
}
|
|
125
|
-
]
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
return SharePointErrorHandler.handle(error, this.logger, 'SharePointListFoldersTool');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=SharePointListFoldersTool.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SharePointReadFileTool
|
|
3
|
-
* Read and convert SharePoint files to text
|
|
4
|
-
*/
|
|
5
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
-
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
7
|
-
import { ILogger } from '../../interfaces/ILogger.js';
|
|
8
|
-
export declare class SharePointReadFileTool extends BaseToolController {
|
|
9
|
-
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
10
|
-
get name(): string;
|
|
11
|
-
get description(): string;
|
|
12
|
-
get inputSchema(): any;
|
|
13
|
-
protected validateParams(params: any): void;
|
|
14
|
-
protected handleExecute(params: {
|
|
15
|
-
connectionId: string;
|
|
16
|
-
webUrl: string;
|
|
17
|
-
extractMetadata?: boolean;
|
|
18
|
-
offset?: number;
|
|
19
|
-
limit?: number;
|
|
20
|
-
}): Promise<any>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=SharePointReadFileTool.d.ts.map
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SharePointReadFileTool
|
|
3
|
-
* Read and convert SharePoint files to text
|
|
4
|
-
*/
|
|
5
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
-
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
7
|
-
import { SharePointErrorHandler } from '../../utils/SharePointErrorHandler.js';
|
|
8
|
-
export class SharePointReadFileTool extends BaseToolController {
|
|
9
|
-
constructor(ucmClient, logger, publishingAuthorId) {
|
|
10
|
-
super(ucmClient, logger, publishingAuthorId);
|
|
11
|
-
}
|
|
12
|
-
get name() {
|
|
13
|
-
return 'ucm_sharepoint_read_file';
|
|
14
|
-
}
|
|
15
|
-
get description() {
|
|
16
|
-
return 'Read a file from SharePoint and convert it to text. Supports Office documents (Word, Excel, PowerPoint), PDFs, and text files. Maximum file size is 20MB. Provide either a full SharePoint URL or relative path. Supports pagination with offset/limit for TEXT CONTENT ONLY. Pagination parameters are ignored for binary files (images, PDFs with embedded images).';
|
|
17
|
-
}
|
|
18
|
-
get inputSchema() {
|
|
19
|
-
return {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
connectionId: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
description: 'SharePoint connection ID to use for reading file (get this from list_connections)',
|
|
25
|
-
minLength: 36,
|
|
26
|
-
maxLength: 36
|
|
27
|
-
},
|
|
28
|
-
webUrl: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
description: 'SharePoint file URL (e.g., "https://contoso.sharepoint.com/sites/Sales/Shared Documents/report.docx") OR relative path ("/Shared Documents/report.docx")',
|
|
31
|
-
minLength: 1,
|
|
32
|
-
maxLength: 2000
|
|
33
|
-
},
|
|
34
|
-
extractMetadata: {
|
|
35
|
-
type: 'boolean',
|
|
36
|
-
description: 'Include file metadata in response (default: true)'
|
|
37
|
-
},
|
|
38
|
-
offset: {
|
|
39
|
-
type: 'number',
|
|
40
|
-
description: 'Number of characters to skip from the start of the content (default: 0). Pagination for text content only - ignored for binary/image files.',
|
|
41
|
-
minimum: 0
|
|
42
|
-
},
|
|
43
|
-
limit: {
|
|
44
|
-
type: 'number',
|
|
45
|
-
description: 'Maximum number of characters to return (default: unlimited). Pagination for text content only - ignored for binary/image files.',
|
|
46
|
-
minimum: 1
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
required: ['connectionId', 'webUrl'],
|
|
50
|
-
additionalProperties: false
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
validateParams(params) {
|
|
54
|
-
super.validateParams(params);
|
|
55
|
-
// Validate connectionId is UUID format
|
|
56
|
-
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
57
|
-
if (!uuidPattern.test(params.connectionId)) {
|
|
58
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Connection ID must be a valid UUID');
|
|
59
|
-
}
|
|
60
|
-
// Validate that webUrl is provided
|
|
61
|
-
if (!params.webUrl || typeof params.webUrl !== 'string' || params.webUrl.trim() === '') {
|
|
62
|
-
throw new McpError(McpErrorCode.InvalidParams, 'File URL is required and must be a non-empty string');
|
|
63
|
-
}
|
|
64
|
-
// Set boolean defaults
|
|
65
|
-
if (params.extractMetadata === undefined) {
|
|
66
|
-
params.extractMetadata = true;
|
|
67
|
-
}
|
|
68
|
-
// Validate and set offset/limit defaults
|
|
69
|
-
if (params.offset !== undefined) {
|
|
70
|
-
if (typeof params.offset !== 'number' || params.offset < 0) {
|
|
71
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Offset must be a non-negative number');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
params.offset = 0;
|
|
76
|
-
}
|
|
77
|
-
if (params.limit !== undefined) {
|
|
78
|
-
if (typeof params.limit !== 'number' || params.limit < 1) {
|
|
79
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Limit must be a positive number');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
async handleExecute(params) {
|
|
84
|
-
this.logger.info('SharePointReadFileTool', `Reading file: ${params.webUrl} (offset: ${params.offset || 0}, limit: ${params.limit || 'unlimited'})`);
|
|
85
|
-
try {
|
|
86
|
-
// Call the API to read and convert SharePoint file
|
|
87
|
-
// organizationId is auto-detected from auth token in V1 API
|
|
88
|
-
const readParams = {
|
|
89
|
-
fileUrl: params.webUrl, // Map webUrl parameter to fileUrl for internal command
|
|
90
|
-
extractMetadata: params.extractMetadata
|
|
91
|
-
};
|
|
92
|
-
// Add pagination parameters if provided
|
|
93
|
-
if (params.offset !== undefined) {
|
|
94
|
-
readParams.offset = params.offset;
|
|
95
|
-
}
|
|
96
|
-
if (params.limit !== undefined) {
|
|
97
|
-
readParams.limit = params.limit;
|
|
98
|
-
}
|
|
99
|
-
// Make API call via UCM client (V1 API)
|
|
100
|
-
const result = await this.ucmClient.sharePointReadFile(params.connectionId, readParams);
|
|
101
|
-
this.logger.info('SharePointReadFileTool', `File read successfully: ${result.fileName}`);
|
|
102
|
-
// Format response
|
|
103
|
-
const response = {
|
|
104
|
-
success: true,
|
|
105
|
-
fileName: result.fileName,
|
|
106
|
-
fileType: result.fileType,
|
|
107
|
-
contentLength: result.contentLength,
|
|
108
|
-
returnedLength: result.returnedLength,
|
|
109
|
-
offset: result.offset,
|
|
110
|
-
hasMore: result.hasMore,
|
|
111
|
-
content: result.content,
|
|
112
|
-
conversionNotes: result.conversionNotes,
|
|
113
|
-
convertedAt: result.convertedAt,
|
|
114
|
-
viewInBrowserUrl: result.viewInBrowserUrl
|
|
115
|
-
};
|
|
116
|
-
// Add nextOffset if there's more content
|
|
117
|
-
if (result.hasMore && result.nextOffset !== undefined) {
|
|
118
|
-
response.nextOffset = result.nextOffset;
|
|
119
|
-
}
|
|
120
|
-
// Include metadata if requested
|
|
121
|
-
if (params.extractMetadata && result.metadata) {
|
|
122
|
-
response.metadata = result.metadata;
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
content: [
|
|
126
|
-
{
|
|
127
|
-
type: 'text',
|
|
128
|
-
text: JSON.stringify(response, null, 2)
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
// Handle ReadFile-specific errors first
|
|
135
|
-
if (error?.response?.status === 400 && error?.response?.data?.error === 'TENANT_MISMATCH') {
|
|
136
|
-
throw new McpError(McpErrorCode.InvalidParams, 'File URL does not match the connection tenant');
|
|
137
|
-
}
|
|
138
|
-
if (error?.response?.status === 413 || error?.message?.includes('size')) {
|
|
139
|
-
throw new McpError(McpErrorCode.InvalidParams, 'File exceeds maximum size limit of 20MB');
|
|
140
|
-
}
|
|
141
|
-
// Delegate to common SharePoint error handler for generic errors
|
|
142
|
-
return SharePointErrorHandler.handle(error, this.logger, 'SharePointReadFileTool');
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
//# sourceMappingURL=SharePointReadFileTool.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SharePointReadRelatedFileTool
|
|
3
|
-
* Retrieve related file (image/embedded file) extracted from a SharePoint document
|
|
4
|
-
*/
|
|
5
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
-
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
7
|
-
import { ILogger } from '../../interfaces/ILogger.js';
|
|
8
|
-
export declare class SharePointReadRelatedFileTool extends BaseToolController {
|
|
9
|
-
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
10
|
-
get name(): string;
|
|
11
|
-
get description(): string;
|
|
12
|
-
get inputSchema(): any;
|
|
13
|
-
protected validateParams(params: any): void;
|
|
14
|
-
protected handleExecute(params: {
|
|
15
|
-
uri: string;
|
|
16
|
-
}): Promise<any>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=SharePointReadRelatedFileTool.d.ts.map
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SharePointReadRelatedFileTool
|
|
3
|
-
* Retrieve related file (image/embedded file) extracted from a SharePoint document
|
|
4
|
-
*/
|
|
5
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
-
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
7
|
-
export class SharePointReadRelatedFileTool extends BaseToolController {
|
|
8
|
-
constructor(ucmClient, logger, publishingAuthorId) {
|
|
9
|
-
super(ucmClient, logger, publishingAuthorId);
|
|
10
|
-
}
|
|
11
|
-
get name() {
|
|
12
|
-
return 'ucm_sharepoint_read_relatedfile';
|
|
13
|
-
}
|
|
14
|
-
get description() {
|
|
15
|
-
return 'Retrieve a related file (image or embedded file) that was extracted from a SharePoint document. Pass the full URI from markdown. Returns complete file. Large images (>500KB original size) may fail with size limit error.';
|
|
16
|
-
}
|
|
17
|
-
get inputSchema() {
|
|
18
|
-
return {
|
|
19
|
-
type: 'object',
|
|
20
|
-
properties: {
|
|
21
|
-
uri: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
description: 'Full URI from markdown (e.g., "file1.jpg?connectionId=...&fileId=...&eTag=..." or without protocol prefix)',
|
|
24
|
-
minLength: 1,
|
|
25
|
-
maxLength: 2000
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
required: ['uri'],
|
|
29
|
-
additionalProperties: false
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
validateParams(params) {
|
|
33
|
-
super.validateParams(params);
|
|
34
|
-
// Validate URI is provided and is a non-empty string
|
|
35
|
-
if (!params.uri || typeof params.uri !== 'string' || params.uri.trim() === '') {
|
|
36
|
-
throw new McpError(McpErrorCode.InvalidParams, 'URI is required and must be a non-empty string');
|
|
37
|
-
}
|
|
38
|
-
// Don't validate format - let server handle parsing and auto-correction
|
|
39
|
-
}
|
|
40
|
-
async handleExecute(params) {
|
|
41
|
-
this.logger.info('SharePointReadRelatedFileTool', `Reading related file from URI: ${params.uri}`);
|
|
42
|
-
try {
|
|
43
|
-
// Call the API to read the related file (no pagination - always complete file)
|
|
44
|
-
const result = await this.ucmClient.sharePointReadRelatedFile(params.uri);
|
|
45
|
-
this.logger.info('SharePointReadRelatedFileTool', `Related file retrieved: ${result.fileName}, size: ${result.size} bytes, content length: ${result.content.length} chars`);
|
|
46
|
-
// Check if base64 content exceeds safe MCP token limit (~15,000 characters)
|
|
47
|
-
// This prevents MCP response errors for large images
|
|
48
|
-
if (result.content.length > 15000) {
|
|
49
|
-
throw new McpError(McpErrorCode.InternalError, 'Image file too large for MCP response. Please resize the image in SharePoint or use the web UI to download.');
|
|
50
|
-
}
|
|
51
|
-
// Check if this is an image file - return as image resource for visual analysis
|
|
52
|
-
if (result.mimeType && result.mimeType.startsWith('image/')) {
|
|
53
|
-
return {
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: 'image',
|
|
57
|
-
data: result.content, // base64 encoded image data
|
|
58
|
-
mimeType: result.mimeType
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'text',
|
|
62
|
-
text: `Image: ${result.fileName}\nSize: ${result.size} bytes\nType: ${result.mimeType}`
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
// For non-image files, return file information as JSON
|
|
68
|
-
const response = {
|
|
69
|
-
success: true,
|
|
70
|
-
fileName: result.fileName,
|
|
71
|
-
mimeType: result.mimeType,
|
|
72
|
-
size: result.size,
|
|
73
|
-
contentLength: result.content.length,
|
|
74
|
-
content: result.content, // base64 encoded binary data
|
|
75
|
-
encoding: 'base64'
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
content: [
|
|
79
|
-
{
|
|
80
|
-
type: 'text',
|
|
81
|
-
text: JSON.stringify(response, null, 2)
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
// Sanitize error for logging to avoid circular reference issues
|
|
88
|
-
const sanitizedError = {
|
|
89
|
-
message: error?.message,
|
|
90
|
-
status: error?.response?.status,
|
|
91
|
-
data: error?.response?.data
|
|
92
|
-
};
|
|
93
|
-
this.logger.error('SharePointReadRelatedFileTool', 'Read related file operation failed', '', sanitizedError);
|
|
94
|
-
// Format error response
|
|
95
|
-
if (error?.response?.status === 404) {
|
|
96
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Related file not found. File may no longer be available. Re-read the parent document to access related files.');
|
|
97
|
-
}
|
|
98
|
-
if (error?.response?.status === 401 || error?.response?.status === 403) {
|
|
99
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Not authorized to access this SharePoint connection or file');
|
|
100
|
-
}
|
|
101
|
-
if (error?.response?.status === 400) {
|
|
102
|
-
throw new McpError(McpErrorCode.InvalidParams, error?.response?.data?.message || 'Invalid request parameters');
|
|
103
|
-
}
|
|
104
|
-
throw new McpError(McpErrorCode.InternalError, `SharePoint read related file failed: ${error?.message || 'Unknown error'}`, { originalError: error?.message });
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=SharePointReadRelatedFileTool.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SharePointSearchTool
|
|
3
|
-
* Search SharePoint documents with text query
|
|
4
|
-
*/
|
|
5
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
-
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
7
|
-
import { ILogger } from '../../interfaces/ILogger.js';
|
|
8
|
-
export declare class SharePointSearchTool extends BaseToolController {
|
|
9
|
-
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
10
|
-
get name(): string;
|
|
11
|
-
get description(): string;
|
|
12
|
-
get inputSchema(): any;
|
|
13
|
-
protected validateParams(params: any): void;
|
|
14
|
-
protected handleExecute(params: {
|
|
15
|
-
connectionId: string;
|
|
16
|
-
query: string;
|
|
17
|
-
limit?: number;
|
|
18
|
-
offset?: number;
|
|
19
|
-
fileType?: string;
|
|
20
|
-
}): Promise<any>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=SharePointSearchTool.d.ts.map
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SharePointSearchTool
|
|
3
|
-
* Search SharePoint documents with text query
|
|
4
|
-
*/
|
|
5
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
-
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
7
|
-
import { SharePointErrorHandler } from '../../utils/SharePointErrorHandler.js';
|
|
8
|
-
export class SharePointSearchTool extends BaseToolController {
|
|
9
|
-
constructor(ucmClient, logger, publishingAuthorId) {
|
|
10
|
-
super(ucmClient, logger, publishingAuthorId);
|
|
11
|
-
}
|
|
12
|
-
get name() {
|
|
13
|
-
return 'ucm_sharepoint_search_documents';
|
|
14
|
-
}
|
|
15
|
-
get description() {
|
|
16
|
-
return 'Search SharePoint documents with text query using Microsoft Search API. Returns document metadata with snippets. Supports pagination and file type filtering via KQL.';
|
|
17
|
-
}
|
|
18
|
-
get inputSchema() {
|
|
19
|
-
return {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
connectionId: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
description: 'SharePoint connection ID to use for searching (get this from list_connections)',
|
|
25
|
-
minLength: 36,
|
|
26
|
-
maxLength: 36
|
|
27
|
-
},
|
|
28
|
-
query: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
description: 'Search query text (optional, defaults to * for all documents)',
|
|
31
|
-
maxLength: 500
|
|
32
|
-
},
|
|
33
|
-
limit: {
|
|
34
|
-
type: 'number',
|
|
35
|
-
description: 'Maximum number of results to return (default: 20, max: 100)',
|
|
36
|
-
minimum: 1,
|
|
37
|
-
maximum: 100
|
|
38
|
-
},
|
|
39
|
-
offset: {
|
|
40
|
-
type: 'number',
|
|
41
|
-
description: 'Number of results to skip for pagination (default: 0)',
|
|
42
|
-
minimum: 0
|
|
43
|
-
},
|
|
44
|
-
fileType: {
|
|
45
|
-
type: 'string',
|
|
46
|
-
description: 'Filter by file extension (e.g., "docx", "pdf", "xlsx") - uses Microsoft Search KQL filtering',
|
|
47
|
-
maxLength: 10
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
required: ['connectionId'],
|
|
51
|
-
additionalProperties: false
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
validateParams(params) {
|
|
55
|
-
super.validateParams(params);
|
|
56
|
-
// Validate connectionId is UUID format
|
|
57
|
-
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
58
|
-
if (!uuidPattern.test(params.connectionId)) {
|
|
59
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Connection ID must be a valid UUID');
|
|
60
|
-
}
|
|
61
|
-
// Validate query
|
|
62
|
-
if (!params.query || typeof params.query !== 'string' || params.query.trim() === '') {
|
|
63
|
-
params.query = '*';
|
|
64
|
-
}
|
|
65
|
-
// Validate and set default limit
|
|
66
|
-
if (params.limit !== undefined) {
|
|
67
|
-
if (typeof params.limit !== 'number' || params.limit < 1 || params.limit > 100) {
|
|
68
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Limit must be between 1 and 100');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
params.limit = 20;
|
|
73
|
-
}
|
|
74
|
-
// Validate and set default offset
|
|
75
|
-
if (params.offset !== undefined) {
|
|
76
|
-
if (typeof params.offset !== 'number' || params.offset < 0) {
|
|
77
|
-
throw new McpError(McpErrorCode.InvalidParams, 'Offset must be 0 or greater');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
params.offset = 0;
|
|
82
|
-
}
|
|
83
|
-
// Validate file type if provided (now supported via Microsoft Search API KQL)
|
|
84
|
-
if (params.fileType && !/^[a-zA-Z0-9]{1,10}$/.test(params.fileType)) {
|
|
85
|
-
throw new McpError(McpErrorCode.InvalidParams, 'File type must be alphanumeric and no more than 10 characters');
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async handleExecute(params) {
|
|
89
|
-
this.logger.info('SharePointSearchTool', `Searching SharePoint with query: "${params.query}"`);
|
|
90
|
-
try {
|
|
91
|
-
// Call the API to search SharePoint documents
|
|
92
|
-
const searchParams = {
|
|
93
|
-
query: params.query,
|
|
94
|
-
limit: params.limit,
|
|
95
|
-
offset: params.offset,
|
|
96
|
-
fileType: params.fileType
|
|
97
|
-
};
|
|
98
|
-
// Make API call via UCM client
|
|
99
|
-
const result = await this.ucmClient.sharePointSearch(params.connectionId, searchParams);
|
|
100
|
-
this.logger.info('SharePointSearchTool', `Search completed, found ${result.totalCount} results`);
|
|
101
|
-
return {
|
|
102
|
-
content: [
|
|
103
|
-
{
|
|
104
|
-
type: 'text',
|
|
105
|
-
text: JSON.stringify({
|
|
106
|
-
success: true,
|
|
107
|
-
query: params.query,
|
|
108
|
-
totalCount: result.totalCount,
|
|
109
|
-
returnedCount: result.files?.length || 0,
|
|
110
|
-
hasMore: result.hasMore,
|
|
111
|
-
limit: params.limit,
|
|
112
|
-
offset: params.offset,
|
|
113
|
-
fileType: params.fileType,
|
|
114
|
-
files: result.files || []
|
|
115
|
-
}, null, 2)
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
return SharePointErrorHandler.handle(error, this.logger, 'SharePointSearchTool');
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
//# sourceMappingURL=SharePointSearchTool.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
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 AuthorIndexTool 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=AuthorIndexTool.d.ts.map
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
-
export class AuthorIndexTool extends BaseToolController {
|
|
3
|
-
constructor(ucmClient, logger, publishingAuthorId) {
|
|
4
|
-
super(ucmClient, logger, publishingAuthorId);
|
|
5
|
-
}
|
|
6
|
-
get name() {
|
|
7
|
-
return 'ucm_workspace_get_index';
|
|
8
|
-
}
|
|
9
|
-
get description() {
|
|
10
|
-
return 'Discover a dynamic markdown index guide for AI assistants working with a workspace\'s content.';
|
|
11
|
-
}
|
|
12
|
-
get inputSchema() {
|
|
13
|
-
return {
|
|
14
|
-
type: 'object',
|
|
15
|
-
properties: {
|
|
16
|
-
workspace: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
description: `Workspace identifier: ${this.publishingAuthorId || '1234567890'}`
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
required: ['workspace']
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
async handleExecute(params) {
|
|
25
|
-
const { workspace } = params;
|
|
26
|
-
const author = workspace;
|
|
27
|
-
this.logger.debug('AuthorIndexTool', `Retrieving author index for: ${author}`);
|
|
28
|
-
try {
|
|
29
|
-
// Get author index content from API (author-level index, not repository-specific)
|
|
30
|
-
const authorIndexContent = await this.ucmClient.getAuthorIndex(author);
|
|
31
|
-
this.logger.info('AuthorIndexTool', 'Author index retrieved successfully', '', {
|
|
32
|
-
author,
|
|
33
|
-
contentLength: authorIndexContent.length,
|
|
34
|
-
source: `UCM API /api/v1/authors/${author}/index`
|
|
35
|
-
});
|
|
36
|
-
return authorIndexContent;
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
let errorMessage = `Failed to retrieve author index for ${author}.`;
|
|
40
|
-
if (this.publishingAuthorId && author != this.publishingAuthorId) {
|
|
41
|
-
errorMessage += ` did you mean '${this.publishingAuthorId}'`;
|
|
42
|
-
error.message = error.message += ` did you mean '${this.publishingAuthorId}'`;
|
|
43
|
-
}
|
|
44
|
-
this.logger.error('AuthorIndexTool', `${errorMessage}`, '', error);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=AuthorIndexTool.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
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 AuthorRecentsTool 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=AuthorRecentsTool.d.ts.map
|