Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4a69e4a
notification unit test
abdulanu0 Oct 28, 2025
23cc975
Added unit tests for notification and tooling
abdulanu0 Nov 2, 2025
04af19e
Fix CI build errors by removing problematic test files with import is…
abdulanu0 Nov 2, 2025
ae2d599
Simplify test directory structure to fix CI import errors
abdulanu0 Nov 2, 2025
05d64ef
Update tests/microsoft-agents-a365-tooling-unittest/utils/test_utilit…
abdulanu0 Nov 2, 2025
0c0444f
fixed copilot comments
abdulanu0 Nov 2, 2025
4731e4a
Merge branch 'users/anabdul/Unittest_Notification_Py' of https://gith…
abdulanu0 Nov 2, 2025
c29d9e7
fixed ruff formatting issues
abdulanu0 Nov 2, 2025
4e19c11
fix infinite recursion bug and class naming issues
abdulanu0 Nov 2, 2025
3516aea
resolved comment
abdulanu0 Nov 2, 2025
f14cdea
Fix import issue
abdulanu0 Nov 2, 2025
3147656
Update copyright headers to Microsoft Corporation format
abdulanu0 Nov 2, 2025
ac6311d
Fix CI import issue by replacing mock MCPServerConfig with real model
abdulanu0 Nov 2, 2025
b767945
Fix CI issues and standardize copyright headers
abdulanu0 Nov 2, 2025
59b71f6
Resolving PR comments: Remove fallback imports, fix copyright headers…
abdulanu0 Nov 7, 2025
2de7f7f
Resolving PR review comments
abdulanu0 Nov 11, 2025
ab99eb6
Merge branch 'main' into users/anabdul/Unittest_Notification_Py
abdulanu0 Nov 11, 2025
6d484c8
Merge main branch - resolved utility.py conflicts
abdulanu0 Dec 2, 2025
2a453eb
Resolving comments
abdulanu0 Dec 2, 2025
53b0d99
Fixed formatting in test_utility.py
abdulanu0 Dec 2, 2025
f4dfb0f
Fixed entity parsing to use properties attribute
abdulanu0 Dec 2, 2025
0a81293
Fixed formatting in agent_notification_activity.py
abdulanu0 Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ build/
.eggs/
.pytest_cache/
_version.py
.coverage
.coverage.*
htmlcov/

# Test coverage and reports
htmlcov/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ def __init__(self, activity: Activity):
entities = self.activity.entities or []
for ent in entities:
etype = ent.type.lower()
payload = getattr(ent, "additional_properties", ent)

# Get the entity payload - check for properties attribute or convert to dict
if hasattr(ent, "properties"):
payload = ent.properties
elif hasattr(ent, "__dict__"):
payload = ent.__dict__
else:
payload = dict(ent) if hasattr(ent, "items") else {}

if etype == NotificationTypes.EMAIL_NOTIFICATION.lower() and self._email is None:
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from microsoft_agents_a365.tooling.models.mcp_server_config import MCPServerConfig
from microsoft_agents_a365.tooling.utils.constants import Constants
from microsoft_agents_a365.tooling.utils.utility import (
get_tools_mode,
get_mcp_platform_authentication_scope,
)

Expand Down Expand Up @@ -112,25 +111,12 @@ async def add_tool_servers_to_agent(
)
self._logger.info(f"🔧 Adding MCP tools from {len(servers)} servers")

# Get tools mode
tools_mode = get_tools_mode()

# Process each server (matching C# foreach pattern)
# Process each server
for server in servers:
try:
if tools_mode == "HardCodedTools":
await self._add_hardcoded_tools_for_server(kernel, server)
continue

headers = {}

if tools_mode == "MockMCPServer":
if mock_auth_header := os.getenv("MOCK_MCP_AUTHORIZATION"):
headers[Constants.Headers.AUTHORIZATION] = mock_auth_header
else:
headers = {
Constants.Headers.AUTHORIZATION: f"{Constants.Headers.BEARER_PREFIX} {auth_token}",
}
headers = {
Constants.Headers.AUTHORIZATION: f"{Constants.Headers.BEARER_PREFIX} {auth_token}",
}

plugin = MCPStreamableHttpPlugin(
name=server.mcp_server_name,
Expand All @@ -151,7 +137,7 @@ async def add_tool_servers_to_agent(
self._connected_plugins.append(plugin)

self._logger.info(
f"✅ Connected and added MCP plugin ({tools_mode}) for: {server.mcp_server_name}"
f"✅ Connected and added MCP plugin for: {server.mcp_server_name}"
)

except Exception as e:
Expand All @@ -172,29 +158,6 @@ def _validate_inputs(self, kernel: Any, agentic_app_id: str, auth_token: str) ->
if not auth_token or not auth_token.strip():
raise ValueError("auth_token cannot be null or empty")

async def _add_hardcoded_tools_for_server(self, kernel: Any, server: MCPServerConfig) -> None:
"""Add hardcoded tools for a specific server (equivalent to C# hardcoded tool logic)."""
server_name = server.mcp_server_name

if server_name.lower() == "mcp_mailtools":
# TODO: Implement hardcoded mail tools
# kernel.plugins.add(KernelPluginFactory.create_from_type(HardCodedMailTools, server.mcp_server_name, self._service_provider))
self._logger.info(f"Adding hardcoded mail tools for {server_name}")
elif server_name.lower() == "mcp_sharepointtools":
# TODO: Implement hardcoded SharePoint tools
# kernel.plugins.add(KernelPluginFactory.create_from_type(HardCodedSharePointTools, server.mcp_server_name, self._service_provider))
self._logger.info(f"Adding hardcoded SharePoint tools for {server_name}")
elif server_name.lower() == "onedrivemcpserver":
# TODO: Implement hardcoded OneDrive tools
# kernel.plugins.add(KernelPluginFactory.create_from_type(HardCodedOneDriveTools, server.mcp_server_name, self._service_provider))
self._logger.info(f"Adding hardcoded OneDrive tools for {server_name}")
elif server_name.lower() == "wordmcpserver":
# TODO: Implement hardcoded Word tools
# kernel.plugins.add(KernelPluginFactory.create_from_type(HardCodedWordTools, server.mcp_server_name, self._service_provider))
self._logger.info(f"Adding hardcoded Word tools for {server_name}")
else:
self._logger.warning(f"No hardcoded tools available for server: {server_name}")

# ============================================================================
# Private Methods - Kernel Function Creation
# ============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
get_tooling_gateway_for_digital_worker,
get_mcp_base_url,
build_mcp_server_url,
get_tools_mode,
get_mcp_platform_authentication_scope,
)

Expand All @@ -19,6 +18,5 @@
"get_tooling_gateway_for_digital_worker",
"get_mcp_base_url",
"build_mcp_server_url",
"get_tools_mode",
"get_mcp_platform_authentication_scope",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
"""

import os
from enum import Enum


class ToolsMode(Enum):
"""Enumeration for different tools modes."""

MOCK_MCP_SERVER = "MockMCPServer"
MCP_PLATFORM = "MCPPlatform"


# Constants for base URLs
Expand Down Expand Up @@ -43,13 +35,6 @@ def get_mcp_base_url() -> str:
Returns:
str: The base URL for MCP servers.
"""
environment = _get_current_environment().lower()

if environment == "development":
tools_mode = get_tools_mode()
if tools_mode == ToolsMode.MOCK_MCP_SERVER:
return os.getenv("MOCK_MCP_SERVER_URL", "http://localhost:5309/mcp-mock/agents/servers")

return f"{_get_mcp_platform_base_url()}/agents/servers"


Expand All @@ -75,7 +60,7 @@ def _get_current_environment() -> str:
Returns:
str: The current environment name.
"""
return os.getenv("ASPNETCORE_ENVIRONMENT") or os.getenv("DOTNET_ENVIRONMENT") or "Development"
return os.getenv("ENVIRONMENT") or "Development"
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removed environment variables ASPNETCORE_ENVIRONMENT and DOTNET_ENVIRONMENT are referenced by "Kairo" in existing code files. According to custom guideline 1000000, the keyword "Kairo" should be removed or replaced with appropriate terminology. Multiple files in the codebase contain "Kairo" references including comments like "Kairo Python SDK", "Kairo tracer", "KairoInstrumentorOpenAIAgents" class names, and module descriptions mentioning "Kairo SDK". These should be updated to use Microsoft-appropriate terminology.

Copilot generated this review using guidance from repository custom instructions.


def _get_mcp_platform_base_url() -> str:
Expand All @@ -91,21 +76,6 @@ def _get_mcp_platform_base_url() -> str:
return MCP_PLATFORM_PROD_BASE_URL


def get_tools_mode() -> ToolsMode:
"""
Gets the tools mode for the application.

Returns:
ToolsMode: The tools mode enum value.
"""
tools_mode = os.getenv("TOOLS_MODE", "MCPPlatform").lower()

if tools_mode == "mockmcpserver":
return ToolsMode.MOCK_MCP_SERVER
else:
return ToolsMode.MCP_PLATFORM


def get_mcp_platform_authentication_scope():
"""
Gets the MCP platform authentication scope based on the current environment.
Expand Down
5 changes: 5 additions & 0 deletions tests/microsoft-agents-a365-notification/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) Microsoft. All rights reserved.
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright header format should be "# Copyright (c) Microsoft Corporation." with "Corporation" included, and "# Licensed under the MIT License." on the second line.

Copilot generated this review using guidance from repository custom instructions.

"""
Unit tests for Microsoft Agents A365 Notifications module.
"""
Comment on lines +1 to +5
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File is missing the standard Microsoft copyright header. Please update the header to:

Copyright (c) Microsoft Corporation.

Licensed under the MIT License.

Add a blank line after the header.

Copilot generated this review using guidance from repository custom instructions.
5 changes: 5 additions & 0 deletions tests/microsoft-agents-a365-notification/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) Microsoft. All rights reserved.
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright header format should be "# Copyright (c) Microsoft Corporation." with "Corporation" included, and "# Licensed under the MIT License." on the second line.

Copilot generated this review using guidance from repository custom instructions.

"""
Unit tests for Microsoft Agents A365 Notifications models.
"""
Comment on lines +1 to +5
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File is missing the standard Microsoft copyright header. Please update the header to:

Copyright (c) Microsoft Corporation.

Licensed under the MIT License.

Add a blank line after the header.

Copilot generated this review using guidance from repository custom instructions.
Loading
Loading