Skip to content

Commit 070febc

Browse files
committed
Fix docstring and return type issues in McpToolRegistrationService
- Correct return type of add_tool_servers_to_agent from Optional[RawAgent] to RawAgent - Update docstring to reference RawAgent instead of stale chat agent - Fix docstring example to use string role user instead of undefined Role.USER
1 parent 0726d25 commit 070febc

File tree

1 file changed

+6
-3
lines changed
  • libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services

1 file changed

+6
-3
lines changed

libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def add_tool_servers_to_agent(
6262
auth_handler_name: str,
6363
turn_context: TurnContext,
6464
auth_token: Optional[str] = None,
65-
) -> Optional[RawAgent]:
65+
) -> RawAgent:
6666
"""
6767
Add MCP tool servers to a RawAgent (mirrors .NET implementation).
6868
@@ -76,7 +76,10 @@ async def add_tool_servers_to_agent(
7676
auth_token: Optional bearer token for authentication
7777
7878
Returns:
79-
RawAgent instance with MCP tools registered, or None if creation failed
79+
RawAgent instance with MCP tools registered.
80+
81+
Raises:
82+
Exception: If agent creation fails.
8083
"""
8184
try:
8285
# Exchange token if not provided
@@ -257,7 +260,7 @@ async def send_chat_history_messages(
257260
258261
Example:
259262
>>> service = McpToolRegistrationService()
260-
>>> messages = [Message(role=Role.USER, text="Hello")]
263+
>>> messages = [Message(role="user", text="Hello")]
261264
>>> result = await service.send_chat_history_messages(messages, turn_context)
262265
>>> if result.succeeded:
263266
... print("Chat history sent successfully")

0 commit comments

Comments
 (0)