@microsoft/agents-a365-tooling 0.1.0-preview.63 → 0.1.0-preview.83

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 (54) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/cjs/McpToolServerConfigurationService.d.ts +43 -1
  3. package/dist/cjs/McpToolServerConfigurationService.d.ts.map +1 -1
  4. package/dist/cjs/McpToolServerConfigurationService.js +65 -13
  5. package/dist/cjs/McpToolServerConfigurationService.js.map +1 -1
  6. package/dist/cjs/Utility.d.ts +26 -8
  7. package/dist/cjs/Utility.d.ts.map +1 -1
  8. package/dist/cjs/Utility.js +44 -17
  9. package/dist/cjs/Utility.js.map +1 -1
  10. package/dist/cjs/contracts.d.ts +3 -0
  11. package/dist/cjs/contracts.d.ts.map +1 -1
  12. package/dist/cjs/index.d.ts +1 -0
  13. package/dist/cjs/index.d.ts.map +1 -1
  14. package/dist/cjs/index.js +1 -0
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/cjs/models/ChatHistoryMessage.d.ts +22 -0
  17. package/dist/cjs/models/ChatHistoryMessage.d.ts.map +1 -0
  18. package/dist/cjs/models/ChatHistoryMessage.js +5 -0
  19. package/dist/cjs/models/ChatHistoryMessage.js.map +1 -0
  20. package/dist/cjs/models/ChatMessageRequest.d.ts +23 -0
  21. package/dist/cjs/models/ChatMessageRequest.d.ts.map +1 -0
  22. package/dist/cjs/models/ChatMessageRequest.js +5 -0
  23. package/dist/cjs/models/ChatMessageRequest.js.map +1 -0
  24. package/dist/cjs/models/index.d.ts +3 -0
  25. package/dist/cjs/models/index.d.ts.map +1 -0
  26. package/dist/cjs/models/index.js +21 -0
  27. package/dist/cjs/models/index.js.map +1 -0
  28. package/dist/esm/McpToolServerConfigurationService.d.ts +43 -1
  29. package/dist/esm/McpToolServerConfigurationService.d.ts.map +1 -1
  30. package/dist/esm/McpToolServerConfigurationService.js +65 -13
  31. package/dist/esm/McpToolServerConfigurationService.js.map +1 -1
  32. package/dist/esm/Utility.d.ts +26 -8
  33. package/dist/esm/Utility.d.ts.map +1 -1
  34. package/dist/esm/Utility.js +44 -17
  35. package/dist/esm/Utility.js.map +1 -1
  36. package/dist/esm/contracts.d.ts +3 -0
  37. package/dist/esm/contracts.d.ts.map +1 -1
  38. package/dist/esm/index.d.ts +1 -0
  39. package/dist/esm/index.d.ts.map +1 -1
  40. package/dist/esm/index.js +1 -0
  41. package/dist/esm/index.js.map +1 -1
  42. package/dist/esm/models/ChatHistoryMessage.d.ts +22 -0
  43. package/dist/esm/models/ChatHistoryMessage.d.ts.map +1 -0
  44. package/dist/esm/models/ChatHistoryMessage.js +4 -0
  45. package/dist/esm/models/ChatHistoryMessage.js.map +1 -0
  46. package/dist/esm/models/ChatMessageRequest.d.ts +23 -0
  47. package/dist/esm/models/ChatMessageRequest.d.ts.map +1 -0
  48. package/dist/esm/models/ChatMessageRequest.js +4 -0
  49. package/dist/esm/models/ChatMessageRequest.js.map +1 -0
  50. package/dist/esm/models/index.d.ts +3 -0
  51. package/dist/esm/models/index.d.ts.map +1 -0
  52. package/dist/esm/models/index.js +5 -0
  53. package/dist/esm/models/index.js.map +1 -0
  54. package/package.json +32 -32
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Microsoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,4 +1,7 @@
1
- import { MCPServerConfig, McpClientTool } from './contracts';
1
+ import { TurnContext } from '@microsoft/agents-hosting';
2
+ import { OperationResult } from '@microsoft/agents-a365-runtime';
3
+ import { MCPServerConfig, McpClientTool, ToolOptions } from './contracts';
4
+ import { ChatHistoryMessage } from './models/index';
2
5
  /**
3
6
  * Service responsible for discovering and normalizing MCP (Model Context Protocol)
4
7
  * tool servers and producing configuration objects consumable by the Claude SDK.
@@ -17,17 +20,56 @@ export declare class McpToolServerConfigurationService {
17
20
  * @returns A promise resolving to an array of normalized MCP server configuration objects.
18
21
  */
19
22
  listToolServers(agenticAppId: string, authToken: string): Promise<MCPServerConfig[]>;
23
+ /**
24
+ * Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
25
+ *
26
+ * @param agenticAppId The agentic app id for which to discover servers.
27
+ * @param authToken Optional bearer token used when querying the remote tooling gateway.
28
+ * @param options Optional tool options when calling the gateway.
29
+ * @returns A promise resolving to an array of normalized MCP server configuration objects.
30
+ */
31
+ listToolServers(agenticAppId: string, authToken: string, options?: ToolOptions): Promise<MCPServerConfig[]>;
20
32
  /**
21
33
  * Connect to the MCP server and return tools with names prefixed by the server name.
22
34
  * Throws if the server URL is missing or the client fails to list tools.
23
35
  */
24
36
  getMcpClientTools(mcpServerName: string, mcpServerConfig: MCPServerConfig): Promise<McpClientTool[]>;
37
+ /**
38
+ * Sends chat history to the MCP platform for real-time threat protection.
39
+ *
40
+ * @param turnContext The turn context containing conversation information.
41
+ * @param chatHistoryMessages The chat history messages to send.
42
+ * @returns A Promise that resolves to an OperationResult indicating success or failure.
43
+ * @throws Error if turnContext or chatHistoryMessages is null/undefined.
44
+ * @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
45
+ * @remarks
46
+ * HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
47
+ * Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
48
+ * Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
49
+ */
50
+ sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[]): Promise<OperationResult>;
51
+ /**
52
+ * Sends chat history to the MCP platform for real-time threat protection.
53
+ *
54
+ * @param turnContext The turn context containing conversation information.
55
+ * @param chatHistoryMessages The chat history messages to send.
56
+ * @param options Optional tool options for sending chat history.
57
+ * @returns A Promise that resolves to an OperationResult indicating success or failure.
58
+ * @throws Error if turnContext or chatHistoryMessages is null/undefined.
59
+ * @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
60
+ * @remarks
61
+ * HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
62
+ * Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
63
+ * Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
64
+ */
65
+ sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[], options?: ToolOptions): Promise<OperationResult>;
25
66
  /**
26
67
  * Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
27
68
  * Throws an error if the gateway call fails.
28
69
  *
29
70
  * @param agenticAppId The agentic app id used by the tooling gateway to scope results.
30
71
  * @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
72
+ * @param options Optional tool options when calling the gateway.
31
73
  * @throws Error when the gateway call fails or returns an unexpected payload.
32
74
  */
33
75
  private getMCPServerConfigsFromToolingGateway;
@@ -1 +1 @@
1
- {"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM7D;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAElC;;OAEG;;IAIH;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAI1F;;;OAGG;IACG,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA8B1G;;;;;;;OAOG;YACW,qCAAqC;IAwBnD;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,+BAA+B;IA8B7C;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAItB"}
1
+ {"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAkB,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAMxE;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAElC;;OAEG;;IAIH;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAE1F;;;;;;;OAOG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAOjH;;;OAGG;IACG,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA8B1G;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAEpH;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAyE3I;;;;;;;;OAQG;YACW,qCAAqC;IAsBnD;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,+BAA+B;IA8B7C;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAItB"}
@@ -9,6 +9,7 @@ exports.McpToolServerConfigurationService = void 0;
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const axios_1 = __importDefault(require("axios"));
12
+ const agents_a365_runtime_1 = require("@microsoft/agents-a365-runtime");
12
13
  const Utility_1 = require("./Utility");
13
14
  const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
14
15
  const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
@@ -23,15 +24,9 @@ class McpToolServerConfigurationService {
23
24
  constructor() {
24
25
  this.logger = console;
25
26
  }
26
- /**
27
- * Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
28
- *
29
- * @param agenticAppId The agentic app id for which to discover servers.
30
- * @param authToken Optional bearer token used when querying the remote tooling gateway.
31
- * @returns A promise resolving to an array of normalized MCP server configuration objects.
32
- */
33
- async listToolServers(agenticAppId, authToken) {
34
- return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() : this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken));
27
+ async listToolServers(agenticAppId, authToken, options) {
28
+ return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() :
29
+ this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options));
35
30
  }
36
31
  /**
37
32
  * Connect to the MCP server and return tools with names prefixed by the server name.
@@ -58,23 +53,80 @@ class McpToolServerConfigurationService {
58
53
  await mcpClient.close();
59
54
  return toolsObj.tools;
60
55
  }
56
+ async sendChatHistory(turnContext, chatHistoryMessages, options) {
57
+ if (!turnContext) {
58
+ throw new Error('turnContext is required');
59
+ }
60
+ if (!chatHistoryMessages) {
61
+ throw new Error('chatHistoryMessages is required');
62
+ }
63
+ // Extract required information from turn context
64
+ const conversationId = turnContext.activity?.conversation?.id;
65
+ if (!conversationId) {
66
+ throw new Error('Conversation ID is required but not found in turn context');
67
+ }
68
+ const messageId = turnContext.activity?.id;
69
+ if (!messageId) {
70
+ throw new Error('Message ID is required but not found in turn context');
71
+ }
72
+ const userMessage = turnContext.activity?.text;
73
+ if (!userMessage) {
74
+ throw new Error('User message is required but not found in turn context');
75
+ }
76
+ // Get the endpoint URL
77
+ const endpoint = Utility_1.Utility.GetChatHistoryEndpoint();
78
+ this.logger.info(`Sending chat history to endpoint: ${endpoint}`);
79
+ // Create the request payload
80
+ const request = {
81
+ conversationId,
82
+ messageId,
83
+ userMessage,
84
+ chatHistory: chatHistoryMessages
85
+ };
86
+ try {
87
+ const headers = Utility_1.Utility.GetToolRequestHeaders(undefined, turnContext, options);
88
+ await axios_1.default.post(endpoint, request, {
89
+ headers: {
90
+ ...headers,
91
+ 'Content-Type': 'application/json'
92
+ },
93
+ timeout: 10000 // 10 seconds timeout
94
+ });
95
+ this.logger.info('Successfully sent chat history to MCP platform');
96
+ return agents_a365_runtime_1.OperationResult.success;
97
+ }
98
+ catch (err) {
99
+ const error = err;
100
+ if (axios_1.default.isAxiosError(err)) {
101
+ if (err.code === 'ECONNABORTED' || err.code === 'ETIMEDOUT') {
102
+ this.logger.error(`Request timeout sending chat history to '${endpoint}': ${error.message}`);
103
+ }
104
+ else {
105
+ this.logger.error(`HTTP error sending chat history to '${endpoint}': ${error.message}`);
106
+ }
107
+ }
108
+ else {
109
+ this.logger.error(`Failed to send chat history to '${endpoint}': ${error.message}`);
110
+ }
111
+ return agents_a365_runtime_1.OperationResult.failed(new agents_a365_runtime_1.OperationError(error));
112
+ }
113
+ }
61
114
  /**
62
115
  * Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
63
116
  * Throws an error if the gateway call fails.
64
117
  *
65
118
  * @param agenticAppId The agentic app id used by the tooling gateway to scope results.
66
119
  * @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
120
+ * @param options Optional tool options when calling the gateway.
67
121
  * @throws Error when the gateway call fails or returns an unexpected payload.
68
122
  */
69
- async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken) {
123
+ async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options) {
70
124
  // Validate the authentication token
71
125
  Utility_1.Utility.ValidateAuthToken(authToken);
72
126
  const configEndpoint = Utility_1.Utility.GetToolingGatewayForDigitalWorker(agenticAppId);
73
127
  try {
74
128
  const response = await axios_1.default.get(configEndpoint, {
75
- headers: {
76
- 'Authorization': authToken ? `Bearer ${authToken}` : undefined,
77
- },
129
+ headers: Utility_1.Utility.GetToolRequestHeaders(authToken, undefined, options),
78
130
  timeout: 10000 // 10 seconds timeout
79
131
  });
80
132
  return (response.data) || [];
@@ -1 +1 @@
1
- {"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;AAElC,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAE1B,uCAAoC;AAEpC,0FAAmG;AACnG,wEAAmE;AAEnE;;;GAGG;AACH,MAAa,iCAAiC;IAG5C;;OAEG;IACH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AI,CAAC;YACH,MAAM,WAAW,GAAG,YAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC3D,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,IAAI,EAAE,CAAC;YAEjD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAkB,EAAE,EAAE;gBAC3C,OAAO;oBACL,aAAa,EAAE,CAAC,CAAC,aAAa;oBAC9B,GAAG,EAAE,iBAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC;iBAChD,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,GAAY,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kDAAkD,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACxG,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,aAAa;QACnB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC/C,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC;IACrD,CAAC;CACF;AAlJD,8EAkJC"}
1
+ {"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;AAElC,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAE1B,wEAAiF;AAGjF,uCAAoC;AAEpC,0FAAmG;AACnG,wEAAmE;AAEnE;;;GAGG;AACH,MAAa,iCAAiC;IAG5C;;OAEG;IACH;QALiB,WAAM,GAAG,OAAO,CAAC;IAMlC,CAAC;IAqBD,KAAK,CAAC,eAAe,CAAC,YAAoB,EAAE,SAAiB,EAA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CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,GAAY,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kDAAkD,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACxG,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,aAAa;QACnB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC/C,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC;IACrD,CAAC;CACF;AApQD,8EAoQC"}
@@ -1,4 +1,19 @@
1
+ import { TurnContext } from '@microsoft/agents-hosting';
2
+ import { ToolOptions } from './contracts';
1
3
  export declare class Utility {
4
+ static readonly HEADER_CHANNEL_ID = "x-ms-channel-id";
5
+ static readonly HEADER_SUBCHANNEL_ID = "x-ms-subchannel-id";
6
+ static readonly HEADER_USER_AGENT = "User-Agent";
7
+ /**
8
+ * Compose standard headers for MCP tooling requests.
9
+ * Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
10
+ *
11
+ * @param authToken Bearer token for Authorization header.
12
+ * @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
13
+ * @param options Optional ToolOptions object for additional request configuration.
14
+ * @returns A headers record suitable for HTTP requests.
15
+ */
16
+ static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext, options?: ToolOptions): Record<string, string>;
2
17
  /**
3
18
  * Validates a JWT authentication token.
4
19
  * Checks that the token is a valid JWT and is not expired.
@@ -44,19 +59,22 @@ export declare class Utility {
44
59
  * @returns The fully-qualified MCP server URL including trailing slash.
45
60
  */
46
61
  static BuildMcpServerUrl(serverName: string): string;
47
- /**
48
- * Reads the current environment name from process.env.
49
- * Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
50
- * If none are set this returns the string 'Development'.
51
- *
52
- * @returns The current environment identifier as a string.
53
- */
54
- private static getCurrentEnvironment;
55
62
  /**
56
63
  * Gets the base URL for MCP platform, defaults to production URL if not set.
57
64
  *
58
65
  * @returns The base URL for MCP platform.
59
66
  */
60
67
  private static getMcpPlatformBaseUrl;
68
+ /**
69
+ * Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
70
+ *
71
+ * @returns An absolute URL that tooling components can use to send or retrieve chat messages for
72
+ * real-time threat protection scenarios.
73
+ * @remarks
74
+ * Call this method when constructing HTTP requests that need to access the chat-message history
75
+ * for real-time threat protection. The returned URL already includes the MCP platform base address
76
+ * and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
77
+ */
78
+ static GetChatHistoryEndpoint(): string;
61
79
  }
62
80
  //# sourceMappingURL=Utility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAMA,qBAAa,OAAO;IAClB;;;;;;OAMG;WACW,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqChC;;;;;;;;;;OAUG;WACW,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAK7E;;;;OAIG;WACW,aAAa,IAAI,MAAM;IAUrC;;;;;;;;;MASE;WACY,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAI,MAAM;IAK5D;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAOpC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAOrC"}
1
+ {"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,qBAAa,OAAO;IAClB,gBAAuB,iBAAiB,qBAAqB;IAC7D,gBAAuB,oBAAoB,wBAAwB;IACnE,gBAAuB,iBAAiB,gBAAgB;IAExD;;;;;;;;OAQG;WACW,qBAAqB,CACjC,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAyBzB;;;;;;OAMG;WACW,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqChC;;;;;;;;;;OAUG;WACW,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAK7E;;;;OAIG;WACW,aAAa,IAAI,MAAM;IAIrC;;;;;;;;;MASE;WACY,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAI,MAAM;IAK5D;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAQpC;;;;;;;;;OASG;WACW,sBAAsB,IAAI,MAAM;CAG/C"}
@@ -3,9 +3,37 @@
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.Utility = void 0;
6
+ const agents_a365_runtime_1 = require("@microsoft/agents-a365-runtime");
6
7
  // Constant for MCP Platform base URL in production
7
8
  const MCP_PLATFORM_PROD_BASE_URL = 'https://agent365.svc.cloud.microsoft';
8
9
  class Utility {
10
+ /**
11
+ * Compose standard headers for MCP tooling requests.
12
+ * Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
13
+ *
14
+ * @param authToken Bearer token for Authorization header.
15
+ * @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
16
+ * @param options Optional ToolOptions object for additional request configuration.
17
+ * @returns A headers record suitable for HTTP requests.
18
+ */
19
+ static GetToolRequestHeaders(authToken, turnContext, options) {
20
+ const headers = {};
21
+ if (authToken) {
22
+ headers['Authorization'] = `Bearer ${authToken}`;
23
+ }
24
+ const channelId = turnContext?.activity?.channelId;
25
+ const subChannelId = turnContext?.activity?.channelIdSubChannel;
26
+ if (channelId) {
27
+ headers[Utility.HEADER_CHANNEL_ID] = channelId;
28
+ }
29
+ if (subChannelId) {
30
+ headers[Utility.HEADER_SUBCHANNEL_ID] = subChannelId;
31
+ }
32
+ if (options?.orchestratorName) {
33
+ headers[Utility.HEADER_USER_AGENT] = agents_a365_runtime_1.Utility.GetUserAgentHeader(options.orchestratorName);
34
+ }
35
+ return headers;
36
+ }
9
37
  /**
10
38
  * Validates a JWT authentication token.
11
39
  * Checks that the token is a valid JWT and is not expired.
@@ -76,10 +104,6 @@ class Utility {
76
104
  * @returns The base MCP environments URL.
77
105
  */
78
106
  static GetMcpBaseUrl() {
79
- const environment = this.getCurrentEnvironment().toLowerCase();
80
- if (environment === 'development') {
81
- return process.env.MOCK_MCP_SERVER_URL || 'http://localhost:5309/mcp-mock/agents/servers';
82
- }
83
107
  return `${this.getMcpPlatformBaseUrl()}/agents/servers`;
84
108
  }
85
109
  /**
@@ -96,19 +120,6 @@ class Utility {
96
120
  const baseUrl = this.GetMcpBaseUrl();
97
121
  return `${baseUrl}/${serverName}`;
98
122
  }
99
- /**
100
- * Reads the current environment name from process.env.
101
- * Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
102
- * If none are set this returns the string 'Development'.
103
- *
104
- * @returns The current environment identifier as a string.
105
- */
106
- static getCurrentEnvironment() {
107
- return process.env.ASPNETCORE_ENVIRONMENT ||
108
- process.env.DOTNET_ENVIRONMENT ||
109
- process.env.NODE_ENV ||
110
- 'Development';
111
- }
112
123
  /**
113
124
  * Gets the base URL for MCP platform, defaults to production URL if not set.
114
125
  *
@@ -120,6 +131,22 @@ class Utility {
120
131
  }
121
132
  return MCP_PLATFORM_PROD_BASE_URL;
122
133
  }
134
+ /**
135
+ * Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
136
+ *
137
+ * @returns An absolute URL that tooling components can use to send or retrieve chat messages for
138
+ * real-time threat protection scenarios.
139
+ * @remarks
140
+ * Call this method when constructing HTTP requests that need to access the chat-message history
141
+ * for real-time threat protection. The returned URL already includes the MCP platform base address
142
+ * and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
143
+ */
144
+ static GetChatHistoryEndpoint() {
145
+ return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
146
+ }
123
147
  }
124
148
  exports.Utility = Utility;
149
+ Utility.HEADER_CHANNEL_ID = 'x-ms-channel-id';
150
+ Utility.HEADER_SUBCHANNEL_ID = 'x-ms-subchannel-id';
151
+ Utility.HEADER_USER_AGENT = 'User-Agent';
125
152
  //# sourceMappingURL=Utility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utility.js","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,mDAAmD;AACnD,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AAE1E,MAAa,OAAO;IAClB;;;;;;OAMG;IACI,MAAM,CAAC,iBAAiB,CAAC,SAA6B;QAC3D,OAAO,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACK,MAAM,CAAC,iBAAiB,CAAC,SAA6B;QAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QAED,qDAAqD;QACrD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,OAEH,CAAC;QAEF,IAAI,CAAC;YACH,8CAA8C;YAC9C,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qB;QAClC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;YACtC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;QAC3C,CAAC;QAED,OAAO,0BAA0B,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,sBAAsB;QAClC,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,kDAAkD,CAAC;IAC3F,CAAC;;AAnKH,0BAoKC;AAnKwB,yBAAiB,GAAG,iBAAiB,CAAC;AACtC,4BAAoB,GAAG,oBAAoB,CAAC;AAC5C,yBAAiB,GAAG,YAAY,CAAC"}
@@ -14,4 +14,7 @@ export interface InputSchema {
14
14
  required?: string[];
15
15
  additionalProperties?: boolean;
16
16
  }
17
+ export interface ToolOptions {
18
+ orchestratorName?: string;
19
+ }
17
20
  //# sourceMappingURL=contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
@@ -1,4 +1,5 @@
1
1
  export * from './Utility';
2
2
  export * from './McpToolServerConfigurationService';
3
3
  export * from './contracts';
4
+ export * from './models';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Utility"), exports);
18
18
  __exportStar(require("./McpToolServerConfigurationService"), exports);
19
19
  __exportStar(require("./contracts"), exports);
20
+ __exportStar(require("./models"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,sEAAoD;AACpD,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,sEAAoD;AACpD,8CAA4B;AAC5B,2CAAyB"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Represents a single message in the chat history.
3
+ */
4
+ export interface ChatHistoryMessage {
5
+ /**
6
+ * The unique identifier for the chat message.
7
+ */
8
+ id: string;
9
+ /**
10
+ * The role of the message sender (e.g., "user", "assistant", "system").
11
+ */
12
+ role: string;
13
+ /**
14
+ * The content of the chat message.
15
+ */
16
+ content: string;
17
+ /**
18
+ * The timestamp of when the message was sent.
19
+ */
20
+ timestamp: Date;
21
+ }
22
+ //# sourceMappingURL=ChatHistoryMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatHistoryMessage.d.ts","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=ChatHistoryMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatHistoryMessage.js","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
@@ -0,0 +1,23 @@
1
+ import { ChatHistoryMessage } from './ChatHistoryMessage';
2
+ /**
3
+ * Represents the request payload for a real-time threat protection check on a chat message.
4
+ */
5
+ export interface ChatMessageRequest {
6
+ /**
7
+ * The unique identifier for the conversation.
8
+ */
9
+ conversationId: string;
10
+ /**
11
+ * The unique identifier for the message within the conversation.
12
+ */
13
+ messageId: string;
14
+ /**
15
+ * The content of the user's message.
16
+ */
17
+ userMessage: string;
18
+ /**
19
+ * The chat history messages.
20
+ */
21
+ chatHistory: ChatHistoryMessage[];
22
+ }
23
+ //# sourceMappingURL=ChatMessageRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatMessageRequest.d.ts","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=ChatMessageRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatMessageRequest.js","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
@@ -0,0 +1,3 @@
1
+ export * from './ChatHistoryMessage';
2
+ export * from './ChatMessageRequest';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __exportStar(require("./ChatHistoryMessage"), exports);
20
+ __exportStar(require("./ChatMessageRequest"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;AAElC,uDAAqC;AACrC,uDAAqC"}
@@ -1,4 +1,7 @@
1
- import { MCPServerConfig, McpClientTool } from './contracts';
1
+ import { TurnContext } from '@microsoft/agents-hosting';
2
+ import { OperationResult } from '@microsoft/agents-a365-runtime';
3
+ import { MCPServerConfig, McpClientTool, ToolOptions } from './contracts';
4
+ import { ChatHistoryMessage } from './models/index';
2
5
  /**
3
6
  * Service responsible for discovering and normalizing MCP (Model Context Protocol)
4
7
  * tool servers and producing configuration objects consumable by the Claude SDK.
@@ -17,17 +20,56 @@ export declare class McpToolServerConfigurationService {
17
20
  * @returns A promise resolving to an array of normalized MCP server configuration objects.
18
21
  */
19
22
  listToolServers(agenticAppId: string, authToken: string): Promise<MCPServerConfig[]>;
23
+ /**
24
+ * Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
25
+ *
26
+ * @param agenticAppId The agentic app id for which to discover servers.
27
+ * @param authToken Optional bearer token used when querying the remote tooling gateway.
28
+ * @param options Optional tool options when calling the gateway.
29
+ * @returns A promise resolving to an array of normalized MCP server configuration objects.
30
+ */
31
+ listToolServers(agenticAppId: string, authToken: string, options?: ToolOptions): Promise<MCPServerConfig[]>;
20
32
  /**
21
33
  * Connect to the MCP server and return tools with names prefixed by the server name.
22
34
  * Throws if the server URL is missing or the client fails to list tools.
23
35
  */
24
36
  getMcpClientTools(mcpServerName: string, mcpServerConfig: MCPServerConfig): Promise<McpClientTool[]>;
37
+ /**
38
+ * Sends chat history to the MCP platform for real-time threat protection.
39
+ *
40
+ * @param turnContext The turn context containing conversation information.
41
+ * @param chatHistoryMessages The chat history messages to send.
42
+ * @returns A Promise that resolves to an OperationResult indicating success or failure.
43
+ * @throws Error if turnContext or chatHistoryMessages is null/undefined.
44
+ * @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
45
+ * @remarks
46
+ * HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
47
+ * Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
48
+ * Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
49
+ */
50
+ sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[]): Promise<OperationResult>;
51
+ /**
52
+ * Sends chat history to the MCP platform for real-time threat protection.
53
+ *
54
+ * @param turnContext The turn context containing conversation information.
55
+ * @param chatHistoryMessages The chat history messages to send.
56
+ * @param options Optional tool options for sending chat history.
57
+ * @returns A Promise that resolves to an OperationResult indicating success or failure.
58
+ * @throws Error if turnContext or chatHistoryMessages is null/undefined.
59
+ * @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
60
+ * @remarks
61
+ * HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
62
+ * Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
63
+ * Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
64
+ */
65
+ sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[], options?: ToolOptions): Promise<OperationResult>;
25
66
  /**
26
67
  * Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
27
68
  * Throws an error if the gateway call fails.
28
69
  *
29
70
  * @param agenticAppId The agentic app id used by the tooling gateway to scope results.
30
71
  * @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
72
+ * @param options Optional tool options when calling the gateway.
31
73
  * @throws Error when the gateway call fails or returns an unexpected payload.
32
74
  */
33
75
  private getMCPServerConfigsFromToolingGateway;
@@ -1 +1 @@
1
- {"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM7D;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAElC;;OAEG;;IAIH;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAI1F;;;OAGG;IACG,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA8B1G;;;;;;;OAOG;YACW,qCAAqC;IAwBnD;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,+BAA+B;IA8B7C;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAItB"}
1
+ {"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAkB,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAMxE;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAElC;;OAEG;;IAIH;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAE1F;;;;;;;OAOG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAOjH;;;OAGG;IACG,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA8B1G;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAEpH;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAyE3I;;;;;;;;OAQG;YACW,qCAAqC;IAsBnD;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,+BAA+B;IA8B7C;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAItB"}
@@ -3,6 +3,7 @@
3
3
  import fs from 'fs';
4
4
  import path from 'path';
5
5
  import axios from 'axios';
6
+ import { OperationResult, OperationError } from '@microsoft/agents-a365-runtime';
6
7
  import { Utility } from './Utility';
7
8
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
8
9
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
@@ -17,15 +18,9 @@ export class McpToolServerConfigurationService {
17
18
  constructor() {
18
19
  this.logger = console;
19
20
  }
20
- /**
21
- * Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
22
- *
23
- * @param agenticAppId The agentic app id for which to discover servers.
24
- * @param authToken Optional bearer token used when querying the remote tooling gateway.
25
- * @returns A promise resolving to an array of normalized MCP server configuration objects.
26
- */
27
- async listToolServers(agenticAppId, authToken) {
28
- return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() : this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken));
21
+ async listToolServers(agenticAppId, authToken, options) {
22
+ return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() :
23
+ this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options));
29
24
  }
30
25
  /**
31
26
  * Connect to the MCP server and return tools with names prefixed by the server name.
@@ -52,23 +47,80 @@ export class McpToolServerConfigurationService {
52
47
  await mcpClient.close();
53
48
  return toolsObj.tools;
54
49
  }
50
+ async sendChatHistory(turnContext, chatHistoryMessages, options) {
51
+ if (!turnContext) {
52
+ throw new Error('turnContext is required');
53
+ }
54
+ if (!chatHistoryMessages) {
55
+ throw new Error('chatHistoryMessages is required');
56
+ }
57
+ // Extract required information from turn context
58
+ const conversationId = turnContext.activity?.conversation?.id;
59
+ if (!conversationId) {
60
+ throw new Error('Conversation ID is required but not found in turn context');
61
+ }
62
+ const messageId = turnContext.activity?.id;
63
+ if (!messageId) {
64
+ throw new Error('Message ID is required but not found in turn context');
65
+ }
66
+ const userMessage = turnContext.activity?.text;
67
+ if (!userMessage) {
68
+ throw new Error('User message is required but not found in turn context');
69
+ }
70
+ // Get the endpoint URL
71
+ const endpoint = Utility.GetChatHistoryEndpoint();
72
+ this.logger.info(`Sending chat history to endpoint: ${endpoint}`);
73
+ // Create the request payload
74
+ const request = {
75
+ conversationId,
76
+ messageId,
77
+ userMessage,
78
+ chatHistory: chatHistoryMessages
79
+ };
80
+ try {
81
+ const headers = Utility.GetToolRequestHeaders(undefined, turnContext, options);
82
+ await axios.post(endpoint, request, {
83
+ headers: {
84
+ ...headers,
85
+ 'Content-Type': 'application/json'
86
+ },
87
+ timeout: 10000 // 10 seconds timeout
88
+ });
89
+ this.logger.info('Successfully sent chat history to MCP platform');
90
+ return OperationResult.success;
91
+ }
92
+ catch (err) {
93
+ const error = err;
94
+ if (axios.isAxiosError(err)) {
95
+ if (err.code === 'ECONNABORTED' || err.code === 'ETIMEDOUT') {
96
+ this.logger.error(`Request timeout sending chat history to '${endpoint}': ${error.message}`);
97
+ }
98
+ else {
99
+ this.logger.error(`HTTP error sending chat history to '${endpoint}': ${error.message}`);
100
+ }
101
+ }
102
+ else {
103
+ this.logger.error(`Failed to send chat history to '${endpoint}': ${error.message}`);
104
+ }
105
+ return OperationResult.failed(new OperationError(error));
106
+ }
107
+ }
55
108
  /**
56
109
  * Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
57
110
  * Throws an error if the gateway call fails.
58
111
  *
59
112
  * @param agenticAppId The agentic app id used by the tooling gateway to scope results.
60
113
  * @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
114
+ * @param options Optional tool options when calling the gateway.
61
115
  * @throws Error when the gateway call fails or returns an unexpected payload.
62
116
  */
63
- async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken) {
117
+ async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options) {
64
118
  // Validate the authentication token
65
119
  Utility.ValidateAuthToken(authToken);
66
120
  const configEndpoint = Utility.GetToolingGatewayForDigitalWorker(agenticAppId);
67
121
  try {
68
122
  const response = await axios.get(configEndpoint, {
69
- headers: {
70
- 'Authorization': authToken ? `Bearer ${authToken}` : undefined,
71
- },
123
+ headers: Utility.GetToolRequestHeaders(authToken, undefined, options),
72
124
  timeout: 10000 // 10 seconds timeout
73
125
  });
74
126
  return (response.data) || [];
@@ -1 +1 @@
1
- {"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE;;;GAGG;AACH,MAAM,OAAO,iCAAiC;IAG5C;;OAEG;IACH;QALiB,WAAM,GAAG,OAAO,CAAC;IAMlC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,YAAoB,EAAE,SAAiB;QAC3D,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IACrJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CAAC,aAAqB,EAAE,eAAgC;QAC7E,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,6BAA6B,CACjD,IAAI,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAC5B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OAIG;IACK,aAAa;QACnB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC/C,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC;IACrD,CAAC;CACF"}
1
+ {"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGjF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE;;;GAGG;AACH,MAAM,OAAO,iCAAiC;IAG5C;;OAEG;IACH;QALiB,WAAM,GAAG,OAAO,CAAC;IAMlC,CAAC;IAqBD,KAAK,CAAC,eAAe,CAAC,YAAoB,EAAE,SAAiB,EAAE,OAAqB;QAClF,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC,CAAC;YAC3E,IAAI,CAAC,qCAAqC,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CAAC,aAAqB,EAAE,eAAgC;QAC7E,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,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ToolOptions } from './contracts';
1
3
  export declare class Utility {
4
+ static readonly HEADER_CHANNEL_ID = "x-ms-channel-id";
5
+ static readonly HEADER_SUBCHANNEL_ID = "x-ms-subchannel-id";
6
+ static readonly HEADER_USER_AGENT = "User-Agent";
7
+ /**
8
+ * Compose standard headers for MCP tooling requests.
9
+ * Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
10
+ *
11
+ * @param authToken Bearer token for Authorization header.
12
+ * @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
13
+ * @param options Optional ToolOptions object for additional request configuration.
14
+ * @returns A headers record suitable for HTTP requests.
15
+ */
16
+ static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext, options?: ToolOptions): Record<string, string>;
2
17
  /**
3
18
  * Validates a JWT authentication token.
4
19
  * Checks that the token is a valid JWT and is not expired.
@@ -44,19 +59,22 @@ export declare class Utility {
44
59
  * @returns The fully-qualified MCP server URL including trailing slash.
45
60
  */
46
61
  static BuildMcpServerUrl(serverName: string): string;
47
- /**
48
- * Reads the current environment name from process.env.
49
- * Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
50
- * If none are set this returns the string 'Development'.
51
- *
52
- * @returns The current environment identifier as a string.
53
- */
54
- private static getCurrentEnvironment;
55
62
  /**
56
63
  * Gets the base URL for MCP platform, defaults to production URL if not set.
57
64
  *
58
65
  * @returns The base URL for MCP platform.
59
66
  */
60
67
  private static getMcpPlatformBaseUrl;
68
+ /**
69
+ * Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
70
+ *
71
+ * @returns An absolute URL that tooling components can use to send or retrieve chat messages for
72
+ * real-time threat protection scenarios.
73
+ * @remarks
74
+ * Call this method when constructing HTTP requests that need to access the chat-message history
75
+ * for real-time threat protection. The returned URL already includes the MCP platform base address
76
+ * and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
77
+ */
78
+ static GetChatHistoryEndpoint(): string;
61
79
  }
62
80
  //# sourceMappingURL=Utility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAMA,qBAAa,OAAO;IAClB;;;;;;OAMG;WACW,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqChC;;;;;;;;;;OAUG;WACW,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAK7E;;;;OAIG;WACW,aAAa,IAAI,MAAM;IAUrC;;;;;;;;;MASE;WACY,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAI,MAAM;IAK5D;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAOpC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAOrC"}
1
+ {"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,qBAAa,OAAO;IAClB,gBAAuB,iBAAiB,qBAAqB;IAC7D,gBAAuB,oBAAoB,wBAAwB;IACnE,gBAAuB,iBAAiB,gBAAgB;IAExD;;;;;;;;OAQG;WACW,qBAAqB,CACjC,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAyBzB;;;;;;OAMG;WACW,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqChC;;;;;;;;;;OAUG;WACW,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAK7E;;;;OAIG;WACW,aAAa,IAAI,MAAM;IAIrC;;;;;;;;;MASE;WACY,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAI,MAAM;IAK5D;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAQpC;;;;;;;;;OASG;WACW,sBAAsB,IAAI,MAAM;CAG/C"}
@@ -1,8 +1,36 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ import { Utility as RuntimeUtility } from '@microsoft/agents-a365-runtime';
3
4
  // Constant for MCP Platform base URL in production
4
5
  const MCP_PLATFORM_PROD_BASE_URL = 'https://agent365.svc.cloud.microsoft';
5
6
  export class Utility {
7
+ /**
8
+ * Compose standard headers for MCP tooling requests.
9
+ * Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
10
+ *
11
+ * @param authToken Bearer token for Authorization header.
12
+ * @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
13
+ * @param options Optional ToolOptions object for additional request configuration.
14
+ * @returns A headers record suitable for HTTP requests.
15
+ */
16
+ static GetToolRequestHeaders(authToken, turnContext, options) {
17
+ const headers = {};
18
+ if (authToken) {
19
+ headers['Authorization'] = `Bearer ${authToken}`;
20
+ }
21
+ const channelId = turnContext?.activity?.channelId;
22
+ const subChannelId = turnContext?.activity?.channelIdSubChannel;
23
+ if (channelId) {
24
+ headers[Utility.HEADER_CHANNEL_ID] = channelId;
25
+ }
26
+ if (subChannelId) {
27
+ headers[Utility.HEADER_SUBCHANNEL_ID] = subChannelId;
28
+ }
29
+ if (options?.orchestratorName) {
30
+ headers[Utility.HEADER_USER_AGENT] = RuntimeUtility.GetUserAgentHeader(options.orchestratorName);
31
+ }
32
+ return headers;
33
+ }
6
34
  /**
7
35
  * Validates a JWT authentication token.
8
36
  * Checks that the token is a valid JWT and is not expired.
@@ -73,10 +101,6 @@ export class Utility {
73
101
  * @returns The base MCP environments URL.
74
102
  */
75
103
  static GetMcpBaseUrl() {
76
- const environment = this.getCurrentEnvironment().toLowerCase();
77
- if (environment === 'development') {
78
- return process.env.MOCK_MCP_SERVER_URL || 'http://localhost:5309/mcp-mock/agents/servers';
79
- }
80
104
  return `${this.getMcpPlatformBaseUrl()}/agents/servers`;
81
105
  }
82
106
  /**
@@ -93,19 +117,6 @@ export class Utility {
93
117
  const baseUrl = this.GetMcpBaseUrl();
94
118
  return `${baseUrl}/${serverName}`;
95
119
  }
96
- /**
97
- * Reads the current environment name from process.env.
98
- * Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
99
- * If none are set this returns the string 'Development'.
100
- *
101
- * @returns The current environment identifier as a string.
102
- */
103
- static getCurrentEnvironment() {
104
- return process.env.ASPNETCORE_ENVIRONMENT ||
105
- process.env.DOTNET_ENVIRONMENT ||
106
- process.env.NODE_ENV ||
107
- 'Development';
108
- }
109
120
  /**
110
121
  * Gets the base URL for MCP platform, defaults to production URL if not set.
111
122
  *
@@ -117,5 +128,21 @@ export class Utility {
117
128
  }
118
129
  return MCP_PLATFORM_PROD_BASE_URL;
119
130
  }
131
+ /**
132
+ * Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
133
+ *
134
+ * @returns An absolute URL that tooling components can use to send or retrieve chat messages for
135
+ * real-time threat protection scenarios.
136
+ * @remarks
137
+ * Call this method when constructing HTTP requests that need to access the chat-message history
138
+ * for real-time threat protection. The returned URL already includes the MCP platform base address
139
+ * and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
140
+ */
141
+ static GetChatHistoryEndpoint() {
142
+ return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
143
+ }
120
144
  }
145
+ Utility.HEADER_CHANNEL_ID = 'x-ms-channel-id';
146
+ Utility.HEADER_SUBCHANNEL_ID = 'x-ms-subchannel-id';
147
+ Utility.HEADER_USER_AGENT = 'User-Agent';
121
148
  //# sourceMappingURL=Utility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utility.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AC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;YACvD,IAAI,OAAO,CAAC,GAAG,GAAG,gBAAgB,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACI,MAAM,CAAC,iCAAiC,CAAC,YAAoB;QAClE,8EAA8E;QAC9E,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,WAAW,YAAY,aAAa,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,aAAa;QACzB,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,CAAC;IAC1D,CAAC;IAED;;;;;;;;;MASE;IACK,MAAM,CAAC,iBAAiB,CAAC,UAAkB;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACrC,OAAO,GAAG,OAAO,IAAI,UAAU,EAAE,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,qBAAqB;QAClC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;YACtC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;QAC3C,CAAC;QAED,OAAO,0BAA0B,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,sBAAsB;QAClC,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,kDAAkD,CAAC;IAC3F,CAAC;;AAlKsB,yBAAiB,GAAG,iBAAiB,CAAC;AACtC,4BAAoB,GAAG,oBAAoB,CAAC;AAC5C,yBAAiB,GAAG,YAAY,CAAC"}
@@ -14,4 +14,7 @@ export interface InputSchema {
14
14
  required?: string[];
15
15
  additionalProperties?: boolean;
16
16
  }
17
+ export interface ToolOptions {
18
+ orchestratorName?: string;
19
+ }
17
20
  //# sourceMappingURL=contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
@@ -1,4 +1,5 @@
1
1
  export * from './Utility';
2
2
  export * from './McpToolServerConfigurationService';
3
3
  export * from './contracts';
4
+ export * from './models';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './Utility';
2
2
  export * from './McpToolServerConfigurationService';
3
3
  export * from './contracts';
4
+ export * from './models';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Represents a single message in the chat history.
3
+ */
4
+ export interface ChatHistoryMessage {
5
+ /**
6
+ * The unique identifier for the chat message.
7
+ */
8
+ id: string;
9
+ /**
10
+ * The role of the message sender (e.g., "user", "assistant", "system").
11
+ */
12
+ role: string;
13
+ /**
14
+ * The content of the chat message.
15
+ */
16
+ content: string;
17
+ /**
18
+ * The timestamp of when the message was sent.
19
+ */
20
+ timestamp: Date;
21
+ }
22
+ //# sourceMappingURL=ChatHistoryMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatHistoryMessage.d.ts","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export {};
4
+ //# sourceMappingURL=ChatHistoryMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatHistoryMessage.js","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC"}
@@ -0,0 +1,23 @@
1
+ import { ChatHistoryMessage } from './ChatHistoryMessage';
2
+ /**
3
+ * Represents the request payload for a real-time threat protection check on a chat message.
4
+ */
5
+ export interface ChatMessageRequest {
6
+ /**
7
+ * The unique identifier for the conversation.
8
+ */
9
+ conversationId: string;
10
+ /**
11
+ * The unique identifier for the message within the conversation.
12
+ */
13
+ messageId: string;
14
+ /**
15
+ * The content of the user's message.
16
+ */
17
+ userMessage: string;
18
+ /**
19
+ * The chat history messages.
20
+ */
21
+ chatHistory: ChatHistoryMessage[];
22
+ }
23
+ //# sourceMappingURL=ChatMessageRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatMessageRequest.d.ts","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export {};
4
+ //# sourceMappingURL=ChatMessageRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatMessageRequest.js","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC"}
@@ -0,0 +1,3 @@
1
+ export * from './ChatHistoryMessage';
2
+ export * from './ChatMessageRequest';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export * from './ChatHistoryMessage';
4
+ export * from './ChatMessageRequest';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,24 +1,10 @@
1
1
  {
2
2
  "name": "@microsoft/agents-a365-tooling",
3
- "version": "0.1.0-preview.63",
3
+ "version": "0.1.0-preview.83",
4
4
  "description": "Agent 365 Tooling SDK for AI agents built with TypeScript/Node.js",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
8
- "scripts": {
9
- "build:cjs": "npx tsc --project tsconfig.cjs.json",
10
- "build:esm": "npx tsc --project tsconfig.esm.json",
11
- "build": "npm run build:cjs && npm run build:esm",
12
- "build:watch": "npx tsc --watch",
13
- "clean": "npx rimraf dist",
14
- "test": "jest --passWithNoTests",
15
- "test:watch": "jest --watch",
16
- "lint": "eslint src/**/*.ts",
17
- "lint:fix": "eslint src/**/*.ts --fix",
18
- "prepublishOnly": "npm run clean && npm run build",
19
- "ci": "npm ci",
20
- "pack": "node ../../copyFiles.js . && pnpm pack --pack-destination=../"
21
- },
22
8
  "keywords": [
23
9
  "ai",
24
10
  "agents",
@@ -33,23 +19,24 @@
33
19
  "directory": "packages/agents-a365-tooling"
34
20
  },
35
21
  "dependencies": {
36
- "@microsoft/agents-a365-runtime": "0.1.0-preview.63",
37
- "@microsoft/agents-hosting": "catalog:",
38
- "@modelcontextprotocol/sdk": "catalog:",
39
- "express": "catalog:"
22
+ "@microsoft/agents-a365-runtime": "0.1.0-preview.83",
23
+ "@microsoft/agents-hosting": "^1.1.0-alpha.85",
24
+ "@modelcontextprotocol/sdk": "^1.25.2",
25
+ "express": "^5.2.0",
26
+ "hono": "^4.11.4"
40
27
  },
41
28
  "devDependencies": {
42
- "@eslint/js": "catalog:",
43
- "@types/jest": "catalog:",
44
- "@types/node": "catalog:",
45
- "@typescript-eslint/eslint-plugin": "catalog:",
46
- "@typescript-eslint/parser": "catalog:",
47
- "eslint": "catalog:",
48
- "jest": "catalog:",
49
- "rimraf": "catalog:",
50
- "ts-jest": "catalog:",
51
- "typescript": "catalog:",
52
- "typescript-eslint": "catalog:"
29
+ "@eslint/js": "^9.39.1",
30
+ "@types/jest": "^30.0.0",
31
+ "@types/node": "^20.17.0",
32
+ "@typescript-eslint/eslint-plugin": "^8.47.0",
33
+ "@typescript-eslint/parser": "^8.47.0",
34
+ "eslint": "^9.39.1",
35
+ "jest": "^30.2.0",
36
+ "rimraf": "^6.0.0",
37
+ "ts-jest": "^29.4.5",
38
+ "typescript": "^5.9.3",
39
+ "typescript-eslint": "^8.47.0"
53
40
  },
54
41
  "engines": {
55
42
  "node": ">=18.0.0"
@@ -59,5 +46,18 @@
59
46
  "README.md",
60
47
  "CHANGELOG.md",
61
48
  "LICENSE.md"
62
- ]
63
- }
49
+ ],
50
+ "scripts": {
51
+ "build:cjs": "npx tsc --project tsconfig.cjs.json",
52
+ "build:esm": "npx tsc --project tsconfig.esm.json",
53
+ "build": "npm run build:cjs && npm run build:esm",
54
+ "build:watch": "npx tsc --watch",
55
+ "clean": "npx rimraf dist",
56
+ "test": "jest --passWithNoTests",
57
+ "test:watch": "jest --watch",
58
+ "lint": "eslint src/**/*.ts",
59
+ "lint:fix": "eslint src/**/*.ts --fix",
60
+ "ci": "npm ci",
61
+ "pack": "node ../../copyFiles.js . && pnpm pack --pack-destination=../"
62
+ }
63
+ }