Share via


Utility class

Properties

HEADER_AGENT_ID

Header name for sending the agent identifier to MCP platform for logging/analytics.

HEADER_CHANNEL_ID
HEADER_SUBCHANNEL_ID
HEADER_USER_AGENT

Methods

BuildMcpServerUrl(string, IConfigurationProvider<ToolingConfiguration>)

Build the full URL for accessing a specific MCP server.

Example: Utility.BuildMcpServerUrl('MyServer') // => "https://agent365.svc.cloud.microsoft/agents/servers/MyServer/"

GetChatHistoryEndpoint(IConfigurationProvider<ToolingConfiguration>)

Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.

GetMcpBaseUrl(IConfigurationProvider<ToolingConfiguration>)

Get the base URL used to query MCP environments.

GetToolingGatewayForDigitalWorker(string, IConfigurationProvider<ToolingConfiguration>)

Construct the tooling gateway URL for a given agent identity. This endpoint is used to discover MCP servers associated with the specified agent identity.

Example: Utility.GetToolingGatewayForDigitalWorker(agenticAppId) // => "https://agent365.svc.cloud.microsoft/agents/{agenticAppId}/mcpServers"

GetToolRequestHeaders(string, TurnContext, ToolOptions)

Compose standard headers for MCP tooling requests. Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.

ValidateAuthToken(undefined | string)

Validates a JWT authentication token. Checks that the token is a valid JWT and is not expired.

Property Details

HEADER_AGENT_ID

Header name for sending the agent identifier to MCP platform for logging/analytics.

static HEADER_AGENT_ID: "x-ms-agentid" = "x-ms-agentid"

Property Value

"x-ms-agentid"

HEADER_CHANNEL_ID

static HEADER_CHANNEL_ID: "x-ms-channel-id" = "x-ms-channel-id"

Property Value

"x-ms-channel-id"

HEADER_SUBCHANNEL_ID

static HEADER_SUBCHANNEL_ID: "x-ms-subchannel-id" = "x-ms-subchannel-id"

Property Value

"x-ms-subchannel-id"

HEADER_USER_AGENT

static HEADER_USER_AGENT: "User-Agent" = "User-Agent"

Property Value

"User-Agent"

Method Details

BuildMcpServerUrl(string, IConfigurationProvider<ToolingConfiguration>)

Warning

This API is now deprecated.

This method is for internal use only. Use McpToolServerConfigurationService instead.

Build the full URL for accessing a specific MCP server.

Example: Utility.BuildMcpServerUrl('MyServer') // => "https://agent365.svc.cloud.microsoft/agents/servers/MyServer/"

static function BuildMcpServerUrl(serverName: string, configProvider?: IConfigurationProvider<ToolingConfiguration>): string

Parameters

serverName

string

The MCP server resource name.

configProvider

IConfigurationProvider<ToolingConfiguration>

Optional configuration provider. Defaults to defaultToolingConfigurationProvider.

Returns

string

The fully-qualified MCP server URL including trailing slash.

GetChatHistoryEndpoint(IConfigurationProvider<ToolingConfiguration>)

Warning

This API is now deprecated.

This method is for internal use only. Use McpToolServerConfigurationService.sendChatHistory() instead.

Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.

static function GetChatHistoryEndpoint(configProvider?: IConfigurationProvider<ToolingConfiguration>): string

Parameters

configProvider

IConfigurationProvider<ToolingConfiguration>

Optional configuration provider. Defaults to defaultToolingConfigurationProvider.

Returns

string

An absolute URL that tooling components can use to send or retrieve chat messages for real-time threat protection scenarios.

Remarks

Call this method when constructing HTTP requests that need to access the chat-message history for real-time threat protection. The returned URL already includes the MCP platform base address and the fixed path segment /agents/real-time-threat-protection/chat-message.

GetMcpBaseUrl(IConfigurationProvider<ToolingConfiguration>)

Warning

This API is now deprecated.

This method is for internal use only. Use McpToolServerConfigurationService instead.

Get the base URL used to query MCP environments.

static function GetMcpBaseUrl(configProvider?: IConfigurationProvider<ToolingConfiguration>): string

Parameters

configProvider

IConfigurationProvider<ToolingConfiguration>

Optional configuration provider. Defaults to defaultToolingConfigurationProvider.

Returns

string

The base MCP environments URL.

GetToolingGatewayForDigitalWorker(string, IConfigurationProvider<ToolingConfiguration>)

Warning

This API is now deprecated.

This method is for internal use only. Use McpToolServerConfigurationService.listToolServers() instead.

Construct the tooling gateway URL for a given agent identity. This endpoint is used to discover MCP servers associated with the specified agent identity.

Example: Utility.GetToolingGatewayForDigitalWorker(agenticAppId) // => "https://agent365.svc.cloud.microsoft/agents/{agenticAppId}/mcpServers"

static function GetToolingGatewayForDigitalWorker(agenticAppId: string, configProvider?: IConfigurationProvider<ToolingConfiguration>): string

Parameters

agenticAppId

string

The unique identifier for the agent identity.

configProvider

IConfigurationProvider<ToolingConfiguration>

Optional configuration provider. Defaults to defaultToolingConfigurationProvider.

Returns

string

A fully-qualified URL pointing at the tooling gateway for the agent.

GetToolRequestHeaders(string, TurnContext, ToolOptions)

Compose standard headers for MCP tooling requests. Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.

static function GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext, options?: ToolOptions): Record<string, string>

Parameters

authToken

string

Bearer token for Authorization header.

turnContext
TurnContext

Optional TurnContext object from which channel and subchannel IDs are extracted.

options
ToolOptions

Optional ToolOptions object for additional request configuration.

Returns

Record<string, string>

A headers record suitable for HTTP requests.

ValidateAuthToken(undefined | string)

Validates a JWT authentication token. Checks that the token is a valid JWT and is not expired.

static function ValidateAuthToken(authToken: undefined | string)

Parameters

authToken

undefined | string

The JWT token to validate.