agent-swarm-kit 1.1.25 → 1.1.26
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/build/index.cjs +169 -0
- package/build/index.mjs +169 -1
- package/package.json +1 -1
- package/types.d.ts +71 -1
package/build/index.cjs
CHANGED
|
@@ -4912,6 +4912,7 @@ const getAgentName = beginContext(async (clientId) => {
|
|
|
4912
4912
|
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1c, clientId, swarmName);
|
|
4913
4913
|
});
|
|
4914
4914
|
|
|
4915
|
+
const METHOD_NAME_UPDATE$2 = "McpUtils.update";
|
|
4915
4916
|
/**
|
|
4916
4917
|
* A no-operation implementation of the IMCP interface.
|
|
4917
4918
|
* This class provides empty or error-throwing implementations of MCP methods.
|
|
@@ -4938,6 +4939,24 @@ class NoopMCP {
|
|
|
4938
4939
|
});
|
|
4939
4940
|
return [];
|
|
4940
4941
|
}
|
|
4942
|
+
/**
|
|
4943
|
+
* Updates the list of tools for a specific client.
|
|
4944
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
4945
|
+
*/
|
|
4946
|
+
async updateToolsForAll() {
|
|
4947
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
4948
|
+
swarm$1.loggerService.debug(`NoopMCP updateToolsForAll agentName=${this.agentName}`);
|
|
4949
|
+
}
|
|
4950
|
+
/**
|
|
4951
|
+
* Updates the list of tools for a specific client.
|
|
4952
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
4953
|
+
*/
|
|
4954
|
+
async updateToolsForClient(clientId) {
|
|
4955
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
4956
|
+
swarm$1.loggerService.debug(`NoopMCP updateToolsForClient agentName=${this.agentName}`, {
|
|
4957
|
+
clientId,
|
|
4958
|
+
});
|
|
4959
|
+
}
|
|
4941
4960
|
/**
|
|
4942
4961
|
* Checks if a specific tool exists for a given client.
|
|
4943
4962
|
* @param toolName - The name of the tool to check.
|
|
@@ -5020,6 +5039,30 @@ class MergeMCP {
|
|
|
5020
5039
|
}
|
|
5021
5040
|
return false;
|
|
5022
5041
|
}
|
|
5042
|
+
/**
|
|
5043
|
+
* Updates the list of tools for all clients across all merged MCPs.
|
|
5044
|
+
* @returns A promise resolving when the tool update is complete.
|
|
5045
|
+
*/
|
|
5046
|
+
async updateToolsForAll() {
|
|
5047
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5048
|
+
swarm$1.loggerService.debug(`MergeMCP updateToolsForAll agentName=${this.agentName}`);
|
|
5049
|
+
for (const mcp of this.mcpList) {
|
|
5050
|
+
await mcp.updateToolsForAll();
|
|
5051
|
+
}
|
|
5052
|
+
}
|
|
5053
|
+
/**
|
|
5054
|
+
* Updates the list of tools for a specific client across all merged MCPs.
|
|
5055
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
5056
|
+
*/
|
|
5057
|
+
async updateToolsForClient(clientId) {
|
|
5058
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5059
|
+
swarm$1.loggerService.debug(`MergeMCP updateToolsForClient agentName=${this.agentName}`, {
|
|
5060
|
+
clientId,
|
|
5061
|
+
});
|
|
5062
|
+
for (const mcp of this.mcpList) {
|
|
5063
|
+
await mcp.updateToolsForClient(clientId);
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5023
5066
|
/**
|
|
5024
5067
|
* Calls a tool from one of the merged MCPs if it exists.
|
|
5025
5068
|
* @param toolName - The name of the tool to call.
|
|
@@ -5055,6 +5098,35 @@ class MergeMCP {
|
|
|
5055
5098
|
throw new Error(`MergeMCP callTool agentName=${this.agentName} tool not found toolName=${toolName}`);
|
|
5056
5099
|
}
|
|
5057
5100
|
}
|
|
5101
|
+
/**
|
|
5102
|
+
* Utility class for managing MCP updates.
|
|
5103
|
+
* This class provides methods to update tools for all clients or a specific client.
|
|
5104
|
+
* It is used in the context of the MCP (Multi-Client Protocol) system.
|
|
5105
|
+
*/
|
|
5106
|
+
class MCPUtils {
|
|
5107
|
+
/**
|
|
5108
|
+
* Updates the list of tools for all clients or a specific client.
|
|
5109
|
+
* @param mcpName - The name of the MCP to update.
|
|
5110
|
+
* @param clientId - Optional client ID to update tools for a specific client.
|
|
5111
|
+
* @returns A promise resolving when the update is complete.
|
|
5112
|
+
*/
|
|
5113
|
+
async update(mcpName, clientId) {
|
|
5114
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5115
|
+
swarm$1.loggerService.info(METHOD_NAME_UPDATE$2, {
|
|
5116
|
+
mcpName,
|
|
5117
|
+
clientId,
|
|
5118
|
+
});
|
|
5119
|
+
swarm$1.mcpValidationService.validate(mcpName, METHOD_NAME_UPDATE$2);
|
|
5120
|
+
if (clientId) {
|
|
5121
|
+
return await swarm$1.mcpPublicService.updateToolsForClient(METHOD_NAME_UPDATE$2, clientId, mcpName);
|
|
5122
|
+
}
|
|
5123
|
+
return await swarm$1.mcpPublicService.updateToolsForAll(METHOD_NAME_UPDATE$2, mcpName);
|
|
5124
|
+
}
|
|
5125
|
+
}
|
|
5126
|
+
/**
|
|
5127
|
+
* Singleton instance of the MCPUtils class.
|
|
5128
|
+
*/
|
|
5129
|
+
const MCP = new MCPUtils();
|
|
5058
5130
|
|
|
5059
5131
|
/**
|
|
5060
5132
|
* Service class for managing agent connections and operations in the swarm system.
|
|
@@ -15263,6 +15335,30 @@ class ClientMCP {
|
|
|
15263
15335
|
const toolMap = await this.fetchTools(clientId);
|
|
15264
15336
|
return toolMap.has(toolName);
|
|
15265
15337
|
}
|
|
15338
|
+
/**
|
|
15339
|
+
* Updates the list of tools by clearing the cache and invoking the update callback.
|
|
15340
|
+
* @returns A promise resolving when the update is complete.
|
|
15341
|
+
*/
|
|
15342
|
+
async updateToolsForClient(clientId) {
|
|
15343
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
15344
|
+
this.params.logger.debug(`ClientMCP mcpName=${this.params.mcpName} updateToolsForClient`, { clientId });
|
|
15345
|
+
this.fetchTools.clear(clientId);
|
|
15346
|
+
if (this.params.callbacks?.onUpdate) {
|
|
15347
|
+
this.params.callbacks.onUpdate(this.params.mcpName, clientId);
|
|
15348
|
+
}
|
|
15349
|
+
}
|
|
15350
|
+
/**
|
|
15351
|
+
* Updates the list of tools for all clients by clearing the cache and invoking the update callback.
|
|
15352
|
+
* @returns A promise resolving when the update is complete.
|
|
15353
|
+
*/
|
|
15354
|
+
async updateToolsForAll() {
|
|
15355
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
15356
|
+
this.params.logger.debug(`ClientMCP mcpName=${this.params.mcpName} updateToolsForAll`, {});
|
|
15357
|
+
this.fetchTools.clear();
|
|
15358
|
+
if (this.params.callbacks?.onUpdate) {
|
|
15359
|
+
this.params.callbacks.onUpdate(this.params.mcpName, undefined);
|
|
15360
|
+
}
|
|
15361
|
+
}
|
|
15266
15362
|
/**
|
|
15267
15363
|
* Calls a specific tool with the provided parameters.
|
|
15268
15364
|
* @param toolName - The name of the tool to call.
|
|
@@ -15352,6 +15448,27 @@ class MCPConnectionService {
|
|
|
15352
15448
|
});
|
|
15353
15449
|
return await this.getMCP(this.methodContextService.context.mcpName).listTools(clientId);
|
|
15354
15450
|
}
|
|
15451
|
+
/**
|
|
15452
|
+
* Updates the list of tools for all clients.
|
|
15453
|
+
* @returns A promise resolving when the tool update is complete.
|
|
15454
|
+
*/
|
|
15455
|
+
async updateToolsForAll() {
|
|
15456
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15457
|
+
this.loggerService.info(`mcpConnectionService updateToolsForAll`, {});
|
|
15458
|
+
return await this.getMCP(this.methodContextService.context.mcpName).updateToolsForAll();
|
|
15459
|
+
}
|
|
15460
|
+
/**
|
|
15461
|
+
* Updates the list of tools for a specific client.
|
|
15462
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
15463
|
+
* @returns
|
|
15464
|
+
*/
|
|
15465
|
+
async updateToolsForClient(clientId) {
|
|
15466
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15467
|
+
this.loggerService.info(`mcpConnectionService updateToolsForClient`, {
|
|
15468
|
+
clientId,
|
|
15469
|
+
});
|
|
15470
|
+
return await this.getMCP(this.methodContextService.context.mcpName).updateToolsForClient(clientId);
|
|
15471
|
+
}
|
|
15355
15472
|
/**
|
|
15356
15473
|
* Checks if a specific tool exists for a given client.
|
|
15357
15474
|
* @param toolName - The name of the tool to check.
|
|
@@ -15510,6 +15627,57 @@ class MCPPublicService {
|
|
|
15510
15627
|
computeName: "",
|
|
15511
15628
|
});
|
|
15512
15629
|
}
|
|
15630
|
+
/**
|
|
15631
|
+
* Updates the list of tools for all clients within a specified context.
|
|
15632
|
+
* @param methodName - The name of the method for context tracking.
|
|
15633
|
+
* @param mcpName - The name of the MCP to query.
|
|
15634
|
+
* @returns A promise resolving when the update is complete.
|
|
15635
|
+
*/
|
|
15636
|
+
async updateToolsForAll(methodName, mcpName) {
|
|
15637
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15638
|
+
this.loggerService.info(`mcpPublicService updateToolsForAll`, {
|
|
15639
|
+
mcpName,
|
|
15640
|
+
});
|
|
15641
|
+
return await MethodContextService.runInContext(async () => {
|
|
15642
|
+
return await this.mcpConnectionService.updateToolsForAll();
|
|
15643
|
+
}, {
|
|
15644
|
+
methodName,
|
|
15645
|
+
clientId: "",
|
|
15646
|
+
mcpName,
|
|
15647
|
+
agentName: "",
|
|
15648
|
+
swarmName: "",
|
|
15649
|
+
storageName: "",
|
|
15650
|
+
stateName: "",
|
|
15651
|
+
policyName: "",
|
|
15652
|
+
computeName: "",
|
|
15653
|
+
});
|
|
15654
|
+
}
|
|
15655
|
+
/**
|
|
15656
|
+
* Updates the list of tools for a specific client within a specified context.
|
|
15657
|
+
* @param methodName - The name of the method for context tracking.
|
|
15658
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
15659
|
+
* @param mcpName - The name of the MCP to query.
|
|
15660
|
+
* @returns A promise resolving when the update is complete.
|
|
15661
|
+
*/
|
|
15662
|
+
async updateToolsForClient(methodName, clientId, mcpName) {
|
|
15663
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15664
|
+
this.loggerService.info(`mcpPublicService updateToolsForClient`, {
|
|
15665
|
+
clientId,
|
|
15666
|
+
});
|
|
15667
|
+
return await MethodContextService.runInContext(async () => {
|
|
15668
|
+
return await this.mcpConnectionService.updateToolsForClient(clientId);
|
|
15669
|
+
}, {
|
|
15670
|
+
methodName,
|
|
15671
|
+
clientId,
|
|
15672
|
+
mcpName,
|
|
15673
|
+
agentName: "",
|
|
15674
|
+
swarmName: "",
|
|
15675
|
+
storageName: "",
|
|
15676
|
+
stateName: "",
|
|
15677
|
+
policyName: "",
|
|
15678
|
+
computeName: "",
|
|
15679
|
+
});
|
|
15680
|
+
}
|
|
15513
15681
|
/**
|
|
15514
15682
|
* Checks if a specific tool exists for a given client within a specified context.
|
|
15515
15683
|
* @param methodName - The name of the method for context tracking.
|
|
@@ -22324,6 +22492,7 @@ exports.HistoryMemoryInstance = HistoryMemoryInstance;
|
|
|
22324
22492
|
exports.HistoryPersistInstance = HistoryPersistInstance;
|
|
22325
22493
|
exports.Logger = Logger;
|
|
22326
22494
|
exports.LoggerInstance = LoggerInstance;
|
|
22495
|
+
exports.MCP = MCP;
|
|
22327
22496
|
exports.MethodContextService = MethodContextService;
|
|
22328
22497
|
exports.Operator = Operator;
|
|
22329
22498
|
exports.OperatorInstance = OperatorInstance;
|
package/build/index.mjs
CHANGED
|
@@ -4910,6 +4910,7 @@ const getAgentName = beginContext(async (clientId) => {
|
|
|
4910
4910
|
return await swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1c, clientId, swarmName);
|
|
4911
4911
|
});
|
|
4912
4912
|
|
|
4913
|
+
const METHOD_NAME_UPDATE$2 = "McpUtils.update";
|
|
4913
4914
|
/**
|
|
4914
4915
|
* A no-operation implementation of the IMCP interface.
|
|
4915
4916
|
* This class provides empty or error-throwing implementations of MCP methods.
|
|
@@ -4936,6 +4937,24 @@ class NoopMCP {
|
|
|
4936
4937
|
});
|
|
4937
4938
|
return [];
|
|
4938
4939
|
}
|
|
4940
|
+
/**
|
|
4941
|
+
* Updates the list of tools for a specific client.
|
|
4942
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
4943
|
+
*/
|
|
4944
|
+
async updateToolsForAll() {
|
|
4945
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
4946
|
+
swarm$1.loggerService.debug(`NoopMCP updateToolsForAll agentName=${this.agentName}`);
|
|
4947
|
+
}
|
|
4948
|
+
/**
|
|
4949
|
+
* Updates the list of tools for a specific client.
|
|
4950
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
4951
|
+
*/
|
|
4952
|
+
async updateToolsForClient(clientId) {
|
|
4953
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
4954
|
+
swarm$1.loggerService.debug(`NoopMCP updateToolsForClient agentName=${this.agentName}`, {
|
|
4955
|
+
clientId,
|
|
4956
|
+
});
|
|
4957
|
+
}
|
|
4939
4958
|
/**
|
|
4940
4959
|
* Checks if a specific tool exists for a given client.
|
|
4941
4960
|
* @param toolName - The name of the tool to check.
|
|
@@ -5018,6 +5037,30 @@ class MergeMCP {
|
|
|
5018
5037
|
}
|
|
5019
5038
|
return false;
|
|
5020
5039
|
}
|
|
5040
|
+
/**
|
|
5041
|
+
* Updates the list of tools for all clients across all merged MCPs.
|
|
5042
|
+
* @returns A promise resolving when the tool update is complete.
|
|
5043
|
+
*/
|
|
5044
|
+
async updateToolsForAll() {
|
|
5045
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5046
|
+
swarm$1.loggerService.debug(`MergeMCP updateToolsForAll agentName=${this.agentName}`);
|
|
5047
|
+
for (const mcp of this.mcpList) {
|
|
5048
|
+
await mcp.updateToolsForAll();
|
|
5049
|
+
}
|
|
5050
|
+
}
|
|
5051
|
+
/**
|
|
5052
|
+
* Updates the list of tools for a specific client across all merged MCPs.
|
|
5053
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
5054
|
+
*/
|
|
5055
|
+
async updateToolsForClient(clientId) {
|
|
5056
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
5057
|
+
swarm$1.loggerService.debug(`MergeMCP updateToolsForClient agentName=${this.agentName}`, {
|
|
5058
|
+
clientId,
|
|
5059
|
+
});
|
|
5060
|
+
for (const mcp of this.mcpList) {
|
|
5061
|
+
await mcp.updateToolsForClient(clientId);
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5021
5064
|
/**
|
|
5022
5065
|
* Calls a tool from one of the merged MCPs if it exists.
|
|
5023
5066
|
* @param toolName - The name of the tool to call.
|
|
@@ -5053,6 +5096,35 @@ class MergeMCP {
|
|
|
5053
5096
|
throw new Error(`MergeMCP callTool agentName=${this.agentName} tool not found toolName=${toolName}`);
|
|
5054
5097
|
}
|
|
5055
5098
|
}
|
|
5099
|
+
/**
|
|
5100
|
+
* Utility class for managing MCP updates.
|
|
5101
|
+
* This class provides methods to update tools for all clients or a specific client.
|
|
5102
|
+
* It is used in the context of the MCP (Multi-Client Protocol) system.
|
|
5103
|
+
*/
|
|
5104
|
+
class MCPUtils {
|
|
5105
|
+
/**
|
|
5106
|
+
* Updates the list of tools for all clients or a specific client.
|
|
5107
|
+
* @param mcpName - The name of the MCP to update.
|
|
5108
|
+
* @param clientId - Optional client ID to update tools for a specific client.
|
|
5109
|
+
* @returns A promise resolving when the update is complete.
|
|
5110
|
+
*/
|
|
5111
|
+
async update(mcpName, clientId) {
|
|
5112
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5113
|
+
swarm$1.loggerService.info(METHOD_NAME_UPDATE$2, {
|
|
5114
|
+
mcpName,
|
|
5115
|
+
clientId,
|
|
5116
|
+
});
|
|
5117
|
+
swarm$1.mcpValidationService.validate(mcpName, METHOD_NAME_UPDATE$2);
|
|
5118
|
+
if (clientId) {
|
|
5119
|
+
return await swarm$1.mcpPublicService.updateToolsForClient(METHOD_NAME_UPDATE$2, clientId, mcpName);
|
|
5120
|
+
}
|
|
5121
|
+
return await swarm$1.mcpPublicService.updateToolsForAll(METHOD_NAME_UPDATE$2, mcpName);
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
/**
|
|
5125
|
+
* Singleton instance of the MCPUtils class.
|
|
5126
|
+
*/
|
|
5127
|
+
const MCP = new MCPUtils();
|
|
5056
5128
|
|
|
5057
5129
|
/**
|
|
5058
5130
|
* Service class for managing agent connections and operations in the swarm system.
|
|
@@ -15261,6 +15333,30 @@ class ClientMCP {
|
|
|
15261
15333
|
const toolMap = await this.fetchTools(clientId);
|
|
15262
15334
|
return toolMap.has(toolName);
|
|
15263
15335
|
}
|
|
15336
|
+
/**
|
|
15337
|
+
* Updates the list of tools by clearing the cache and invoking the update callback.
|
|
15338
|
+
* @returns A promise resolving when the update is complete.
|
|
15339
|
+
*/
|
|
15340
|
+
async updateToolsForClient(clientId) {
|
|
15341
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
15342
|
+
this.params.logger.debug(`ClientMCP mcpName=${this.params.mcpName} updateToolsForClient`, { clientId });
|
|
15343
|
+
this.fetchTools.clear(clientId);
|
|
15344
|
+
if (this.params.callbacks?.onUpdate) {
|
|
15345
|
+
this.params.callbacks.onUpdate(this.params.mcpName, clientId);
|
|
15346
|
+
}
|
|
15347
|
+
}
|
|
15348
|
+
/**
|
|
15349
|
+
* Updates the list of tools for all clients by clearing the cache and invoking the update callback.
|
|
15350
|
+
* @returns A promise resolving when the update is complete.
|
|
15351
|
+
*/
|
|
15352
|
+
async updateToolsForAll() {
|
|
15353
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
15354
|
+
this.params.logger.debug(`ClientMCP mcpName=${this.params.mcpName} updateToolsForAll`, {});
|
|
15355
|
+
this.fetchTools.clear();
|
|
15356
|
+
if (this.params.callbacks?.onUpdate) {
|
|
15357
|
+
this.params.callbacks.onUpdate(this.params.mcpName, undefined);
|
|
15358
|
+
}
|
|
15359
|
+
}
|
|
15264
15360
|
/**
|
|
15265
15361
|
* Calls a specific tool with the provided parameters.
|
|
15266
15362
|
* @param toolName - The name of the tool to call.
|
|
@@ -15350,6 +15446,27 @@ class MCPConnectionService {
|
|
|
15350
15446
|
});
|
|
15351
15447
|
return await this.getMCP(this.methodContextService.context.mcpName).listTools(clientId);
|
|
15352
15448
|
}
|
|
15449
|
+
/**
|
|
15450
|
+
* Updates the list of tools for all clients.
|
|
15451
|
+
* @returns A promise resolving when the tool update is complete.
|
|
15452
|
+
*/
|
|
15453
|
+
async updateToolsForAll() {
|
|
15454
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15455
|
+
this.loggerService.info(`mcpConnectionService updateToolsForAll`, {});
|
|
15456
|
+
return await this.getMCP(this.methodContextService.context.mcpName).updateToolsForAll();
|
|
15457
|
+
}
|
|
15458
|
+
/**
|
|
15459
|
+
* Updates the list of tools for a specific client.
|
|
15460
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
15461
|
+
* @returns
|
|
15462
|
+
*/
|
|
15463
|
+
async updateToolsForClient(clientId) {
|
|
15464
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15465
|
+
this.loggerService.info(`mcpConnectionService updateToolsForClient`, {
|
|
15466
|
+
clientId,
|
|
15467
|
+
});
|
|
15468
|
+
return await this.getMCP(this.methodContextService.context.mcpName).updateToolsForClient(clientId);
|
|
15469
|
+
}
|
|
15353
15470
|
/**
|
|
15354
15471
|
* Checks if a specific tool exists for a given client.
|
|
15355
15472
|
* @param toolName - The name of the tool to check.
|
|
@@ -15508,6 +15625,57 @@ class MCPPublicService {
|
|
|
15508
15625
|
computeName: "",
|
|
15509
15626
|
});
|
|
15510
15627
|
}
|
|
15628
|
+
/**
|
|
15629
|
+
* Updates the list of tools for all clients within a specified context.
|
|
15630
|
+
* @param methodName - The name of the method for context tracking.
|
|
15631
|
+
* @param mcpName - The name of the MCP to query.
|
|
15632
|
+
* @returns A promise resolving when the update is complete.
|
|
15633
|
+
*/
|
|
15634
|
+
async updateToolsForAll(methodName, mcpName) {
|
|
15635
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15636
|
+
this.loggerService.info(`mcpPublicService updateToolsForAll`, {
|
|
15637
|
+
mcpName,
|
|
15638
|
+
});
|
|
15639
|
+
return await MethodContextService.runInContext(async () => {
|
|
15640
|
+
return await this.mcpConnectionService.updateToolsForAll();
|
|
15641
|
+
}, {
|
|
15642
|
+
methodName,
|
|
15643
|
+
clientId: "",
|
|
15644
|
+
mcpName,
|
|
15645
|
+
agentName: "",
|
|
15646
|
+
swarmName: "",
|
|
15647
|
+
storageName: "",
|
|
15648
|
+
stateName: "",
|
|
15649
|
+
policyName: "",
|
|
15650
|
+
computeName: "",
|
|
15651
|
+
});
|
|
15652
|
+
}
|
|
15653
|
+
/**
|
|
15654
|
+
* Updates the list of tools for a specific client within a specified context.
|
|
15655
|
+
* @param methodName - The name of the method for context tracking.
|
|
15656
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
15657
|
+
* @param mcpName - The name of the MCP to query.
|
|
15658
|
+
* @returns A promise resolving when the update is complete.
|
|
15659
|
+
*/
|
|
15660
|
+
async updateToolsForClient(methodName, clientId, mcpName) {
|
|
15661
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
15662
|
+
this.loggerService.info(`mcpPublicService updateToolsForClient`, {
|
|
15663
|
+
clientId,
|
|
15664
|
+
});
|
|
15665
|
+
return await MethodContextService.runInContext(async () => {
|
|
15666
|
+
return await this.mcpConnectionService.updateToolsForClient(clientId);
|
|
15667
|
+
}, {
|
|
15668
|
+
methodName,
|
|
15669
|
+
clientId,
|
|
15670
|
+
mcpName,
|
|
15671
|
+
agentName: "",
|
|
15672
|
+
swarmName: "",
|
|
15673
|
+
storageName: "",
|
|
15674
|
+
stateName: "",
|
|
15675
|
+
policyName: "",
|
|
15676
|
+
computeName: "",
|
|
15677
|
+
});
|
|
15678
|
+
}
|
|
15511
15679
|
/**
|
|
15512
15680
|
* Checks if a specific tool exists for a given client within a specified context.
|
|
15513
15681
|
* @param methodName - The name of the method for context tracking.
|
|
@@ -22313,4 +22481,4 @@ const Utils = {
|
|
|
22313
22481
|
PersistEmbeddingUtils,
|
|
22314
22482
|
};
|
|
22315
22483
|
|
|
22316
|
-
export { Adapter, Chat, Compute, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, Logger, LoggerInstance, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, RoundRobin, Schema, SharedCompute, SharedState, SharedStorage, State, Storage, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|
|
22484
|
+
export { Adapter, Chat, Compute, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, Logger, LoggerInstance, MCP, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, RoundRobin, Schema, SharedCompute, SharedState, SharedStorage, State, Storage, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -3170,6 +3170,16 @@ interface IMCP {
|
|
|
3170
3170
|
* @returns A promise resolving when the tool call is complete.
|
|
3171
3171
|
*/
|
|
3172
3172
|
callTool<T extends MCPToolValue = MCPToolValue>(toolName: string, dto: IMCPToolCallDto<T>): Promise<MCPToolOutput>;
|
|
3173
|
+
/**
|
|
3174
|
+
* Updates the list of tools by clearing the cache and invoking the update callback.
|
|
3175
|
+
* @returns A promise resolving when the update is complete.
|
|
3176
|
+
*/
|
|
3177
|
+
updateToolsForAll(): Promise<void>;
|
|
3178
|
+
/**
|
|
3179
|
+
* Updates the list of tools by clearing the cache and invoking the update callback.
|
|
3180
|
+
* @returns A promise resolving when the update is complete.
|
|
3181
|
+
*/
|
|
3182
|
+
updateToolsForClient(clientId: string): Promise<void>;
|
|
3173
3183
|
}
|
|
3174
3184
|
/**
|
|
3175
3185
|
* Interface for MCP callback functions triggered during various lifecycle events.
|
|
@@ -3198,6 +3208,11 @@ interface IMCPCallbacks {
|
|
|
3198
3208
|
* @param dto - The data transfer object containing tool call parameters.
|
|
3199
3209
|
*/
|
|
3200
3210
|
onCall<T extends MCPToolValue = MCPToolValue>(toolName: string, dto: IMCPToolCallDto<T>): void;
|
|
3211
|
+
/**
|
|
3212
|
+
* Called when the list of tools is updated.
|
|
3213
|
+
* @param clientId - The ID of the client.
|
|
3214
|
+
*/
|
|
3215
|
+
onUpdate(mcpName: MCPName, clientId: string | undefined): void;
|
|
3201
3216
|
}
|
|
3202
3217
|
/**
|
|
3203
3218
|
* Interface for the MCP schema, defining the structure and behavior of an MCP.
|
|
@@ -9135,6 +9150,16 @@ declare class ClientMCP implements IMCP {
|
|
|
9135
9150
|
* @returns A promise resolving to true if the tool exists, false otherwise.
|
|
9136
9151
|
*/
|
|
9137
9152
|
hasTool(toolName: string, clientId: string): Promise<boolean>;
|
|
9153
|
+
/**
|
|
9154
|
+
* Updates the list of tools by clearing the cache and invoking the update callback.
|
|
9155
|
+
* @returns A promise resolving when the update is complete.
|
|
9156
|
+
*/
|
|
9157
|
+
updateToolsForClient(clientId: string): Promise<void>;
|
|
9158
|
+
/**
|
|
9159
|
+
* Updates the list of tools for all clients by clearing the cache and invoking the update callback.
|
|
9160
|
+
* @returns A promise resolving when the update is complete.
|
|
9161
|
+
*/
|
|
9162
|
+
updateToolsForAll(): Promise<void>;
|
|
9138
9163
|
/**
|
|
9139
9164
|
* Calls a specific tool with the provided parameters.
|
|
9140
9165
|
* @param toolName - The name of the tool to call.
|
|
@@ -9174,6 +9199,17 @@ declare class MCPConnectionService implements IMCP {
|
|
|
9174
9199
|
* @returns A promise resolving to an array of IMCPTool objects.
|
|
9175
9200
|
*/
|
|
9176
9201
|
listTools(clientId: string): Promise<IMCPTool[]>;
|
|
9202
|
+
/**
|
|
9203
|
+
* Updates the list of tools for all clients.
|
|
9204
|
+
* @returns A promise resolving when the tool update is complete.
|
|
9205
|
+
*/
|
|
9206
|
+
updateToolsForAll(): Promise<void>;
|
|
9207
|
+
/**
|
|
9208
|
+
* Updates the list of tools for a specific client.
|
|
9209
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
9210
|
+
* @returns
|
|
9211
|
+
*/
|
|
9212
|
+
updateToolsForClient(clientId: string): Promise<void>;
|
|
9177
9213
|
/**
|
|
9178
9214
|
* Checks if a specific tool exists for a given client.
|
|
9179
9215
|
* @param toolName - The name of the tool to check.
|
|
@@ -9258,6 +9294,21 @@ declare class MCPPublicService implements TMCPConnectionService {
|
|
|
9258
9294
|
* @returns A promise resolving to an array of IMCPTool objects.
|
|
9259
9295
|
*/
|
|
9260
9296
|
listTools(methodName: string, clientId: string, mcpName: string): Promise<IMCPTool[]>;
|
|
9297
|
+
/**
|
|
9298
|
+
* Updates the list of tools for all clients within a specified context.
|
|
9299
|
+
* @param methodName - The name of the method for context tracking.
|
|
9300
|
+
* @param mcpName - The name of the MCP to query.
|
|
9301
|
+
* @returns A promise resolving when the update is complete.
|
|
9302
|
+
*/
|
|
9303
|
+
updateToolsForAll(methodName: string, mcpName: string): Promise<void>;
|
|
9304
|
+
/**
|
|
9305
|
+
* Updates the list of tools for a specific client within a specified context.
|
|
9306
|
+
* @param methodName - The name of the method for context tracking.
|
|
9307
|
+
* @param clientId - The ID of the client whose tools are to be updated.
|
|
9308
|
+
* @param mcpName - The name of the MCP to query.
|
|
9309
|
+
* @returns A promise resolving when the update is complete.
|
|
9310
|
+
*/
|
|
9311
|
+
updateToolsForClient(methodName: string, clientId: string, mcpName: string): Promise<void>;
|
|
9261
9312
|
/**
|
|
9262
9313
|
* Checks if a specific tool exists for a given client within a specified context.
|
|
9263
9314
|
* @param methodName - The name of the method for context tracking.
|
|
@@ -13001,6 +13052,25 @@ declare class RoundRobin<T, Token = string | symbol | {
|
|
|
13001
13052
|
private call;
|
|
13002
13053
|
}
|
|
13003
13054
|
|
|
13055
|
+
/**
|
|
13056
|
+
* Utility class for managing MCP updates.
|
|
13057
|
+
* This class provides methods to update tools for all clients or a specific client.
|
|
13058
|
+
* It is used in the context of the MCP (Multi-Client Protocol) system.
|
|
13059
|
+
*/
|
|
13060
|
+
declare class MCPUtils {
|
|
13061
|
+
/**
|
|
13062
|
+
* Updates the list of tools for all clients or a specific client.
|
|
13063
|
+
* @param mcpName - The name of the MCP to update.
|
|
13064
|
+
* @param clientId - Optional client ID to update tools for a specific client.
|
|
13065
|
+
* @returns A promise resolving when the update is complete.
|
|
13066
|
+
*/
|
|
13067
|
+
update(mcpName: MCPName, clientId?: string): Promise<void>;
|
|
13068
|
+
}
|
|
13069
|
+
/**
|
|
13070
|
+
* Singleton instance of the MCPUtils class.
|
|
13071
|
+
*/
|
|
13072
|
+
declare const MCP: MCPUtils;
|
|
13073
|
+
|
|
13004
13074
|
/**
|
|
13005
13075
|
* Utility class providing methods to manage client bans within a swarm policy context.
|
|
13006
13076
|
* All methods validate inputs and execute within a context for logging and tracking.
|
|
@@ -13802,4 +13872,4 @@ declare const Utils: {
|
|
|
13802
13872
|
PersistEmbeddingUtils: typeof PersistEmbeddingUtils;
|
|
13803
13873
|
};
|
|
13804
13874
|
|
|
13805
|
-
export { Adapter, Chat, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|
|
13875
|
+
export { Adapter, Chat, Compute, type EventSource, ExecutionContextService, History, HistoryMemoryInstance, HistoryPersistInstance, type IAgentSchema, type IAgentTool, type IBaseEvent, type IBusEvent, type IBusEventContext, type IChatArgs, type IChatInstance, type IChatInstanceCallbacks, type ICompletionArgs, type ICompletionSchema, type IComputeSchema, type ICustomEvent, type IEmbeddingSchema, type IGlobalConfig, type IHistoryAdapter, type IHistoryControl, type IHistoryInstance, type IHistoryInstanceCallbacks, type IIncomingMessage, type ILoggerAdapter, type ILoggerInstance, type ILoggerInstanceCallbacks, type IMCPSchema, type IMCPTool, type IMakeConnectionConfig, type IMakeDisposeParams, type IModelMessage, type INavigateToAgentParams, type INavigateToTriageParams, type IOutgoingMessage, type IPersistActiveAgentData, type IPersistAliveData, type IPersistBase, type IPersistEmbeddingData, type IPersistMemoryData, type IPersistNavigationStackData, type IPersistPolicyData, type IPersistStateData, type IPersistStorageData, type IPolicySchema, type ISessionConfig, type IStateSchema, type IStorageData, type IStorageSchema, type ISwarmSchema, type ITool, type IToolCall, type IWikiSchema, Logger, LoggerInstance, MCP, type MCPToolProperties, MethodContextService, Operator, OperatorInstance, PayloadContextService, PersistAlive, PersistBase, PersistEmbedding, PersistList, PersistMemory, PersistPolicy, PersistState, PersistStorage, PersistSwarm, Policy, type ReceiveMessageFn, RoundRobin, Schema, type SendMessageFn, SharedCompute, SharedState, SharedStorage, State, Storage, type THistoryInstanceCtor, type THistoryMemoryInstance, type THistoryPersistInstance, type TLoggerInstance, type TOperatorInstance, type TPersistBase, type TPersistBaseCtor, type TPersistList, type ToolValue, Utils, addAgent, addAgentNavigation, addCompletion, addCompute, addEmbedding, addMCP, addPolicy, addState, addStorage, addSwarm, addTool, addTriageNavigation, addWiki, beginContext, cancelOutput, cancelOutputForce, changeToAgent, changeToDefaultAgent, changeToPrevAgent, commitAssistantMessage, commitAssistantMessageForce, commitFlush, commitFlushForce, commitStopTools, commitStopToolsForce, commitSystemMessage, commitSystemMessageForce, commitToolOutput, commitToolOutputForce, commitUserMessage, commitUserMessageForce, complete, createNavigateToAgent, createNavigateToTriageAgent, disposeConnection, dumpAgent, dumpClientPerformance, dumpDocs, dumpPerfomance, dumpSwarm, emit, emitForce, event, execute, executeForce, getAgentHistory, getAgentName, getAssistantHistory, getLastAssistantMessage, getLastSystemMessage, getLastUserMessage, getNavigationRoute, getPayload, getRawHistory, getSessionContext, getSessionMode, getUserHistory, hasNavigation, hasSession, listenAgentEvent, listenAgentEventOnce, listenEvent, listenEventOnce, listenExecutionEvent, listenExecutionEventOnce, listenHistoryEvent, listenHistoryEventOnce, listenPolicyEvent, listenPolicyEventOnce, listenSessionEvent, listenSessionEventOnce, listenStateEvent, listenStateEventOnce, listenStorageEvent, listenStorageEventOnce, listenSwarmEvent, listenSwarmEventOnce, makeAutoDispose, makeConnection, markOffline, markOnline, notify, notifyForce, overrideAgent, overrideCompletion, overrideCompute, overrideEmbeding, overrideMCP, overridePolicy, overrideState, overrideStorage, overrideSwarm, overrideTool, overrideWiki, question, questionForce, runStateless, runStatelessForce, session, setConfig, swarm };
|