From c067cebf0320ad35ea397bbe1e24ec6637a75e24 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Fri, 30 Jan 2026 15:34:33 -0600 Subject: [PATCH] Updating MCP endpoint parameters to use snake case --- .../azurefunctions/agent_framework_azurefunctions/_app.py | 8 ++++---- python/packages/azurefunctions/tests/test_app.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/python/packages/azurefunctions/agent_framework_azurefunctions/_app.py b/python/packages/azurefunctions/agent_framework_azurefunctions/_app.py index 7a49214b33..58ca0b1c96 100644 --- a/python/packages/azurefunctions/agent_framework_azurefunctions/_app.py +++ b/python/packages/azurefunctions/agent_framework_azurefunctions/_app.py @@ -536,7 +536,7 @@ def _setup_mcp_tool_trigger(self, agent_name: str, agent_description: str | None "isArray": False, }, { - "propertyName": "threadId", + "propertyName": "thread_id", "propertyType": "string", "description": "Optional thread identifier for conversation continuity.", "isRequired": False, @@ -561,7 +561,7 @@ async def mcp_tool_handler(context: str, client: df.DurableOrchestrationClient) """Handle MCP tool invocation for the agent. Args: - context: MCP tool invocation context containing arguments (query, threadId) + context: MCP tool invocation context containing arguments (query, thread_id) client: Durable orchestration client for entity communication Returns: @@ -610,8 +610,8 @@ async def _handle_mcp_tool_invocation( if not query or not isinstance(query, str): raise ValueError("MCP Tool invocation is missing required 'query' argument of type string.") - # Extract optional threadId - thread_id = arguments.get("threadId") + # Extract optional thread_id + thread_id = arguments.get("thread_id") # Create or parse session ID if thread_id and isinstance(thread_id, str) and thread_id.strip(): diff --git a/python/packages/azurefunctions/tests/test_app.py b/python/packages/azurefunctions/tests/test_app.py index f8b414fc34..232e1ddbb3 100644 --- a/python/packages/azurefunctions/tests/test_app.py +++ b/python/packages/azurefunctions/tests/test_app.py @@ -981,7 +981,7 @@ async def test_handle_mcp_tool_invocation_with_json_string(self) -> None: client.read_entity_state.return_value = mock_state # Create JSON string context - context = '{"arguments": {"query": "test query", "threadId": "test-thread"}}' + context = '{"arguments": {"query": "test query", "thread_id": "test-thread"}}' with patch.object(app, "_get_response_from_entity") as get_response_mock: get_response_mock.return_value = {"status": "success", "response": "Test response"} @@ -1008,7 +1008,7 @@ async def test_handle_mcp_tool_invocation_with_json_context(self) -> None: client.read_entity_state.return_value = mock_state # Create JSON string context - context = json.dumps({"arguments": {"query": "test query", "threadId": "test-thread"}}) + context = json.dumps({"arguments": {"query": "test query", "thread_id": "test-thread"}}) with patch.object(app, "_get_response_from_entity") as get_response_mock: get_response_mock.return_value = {"status": "success", "response": "Test response"} @@ -1088,7 +1088,7 @@ async def test_handle_mcp_tool_invocation_ignores_agent_name_in_thread_id(self) # Thread ID contains a different agent name (@StockAdvisor@poc123) # but we're invoking PlantAdvisor - it should use PlantAdvisor's entity - context = json.dumps({"arguments": {"query": "test query", "threadId": "@StockAdvisor@test123"}}) + context = json.dumps({"arguments": {"query": "test query", "thread_id": "@StockAdvisor@test123"}}) with patch.object(app, "_get_response_from_entity") as get_response_mock: get_response_mock.return_value = {"status": "success", "response": "Test response"} @@ -1120,7 +1120,7 @@ async def test_handle_mcp_tool_invocation_uses_plain_thread_id_as_key(self) -> N client.read_entity_state.return_value = mock_state # Plain thread_id without @name@key format - context = json.dumps({"arguments": {"query": "test query", "threadId": "simple-thread-123"}}) + context = json.dumps({"arguments": {"query": "test query", "thread_id": "simple-thread-123"}}) with patch.object(app, "_get_response_from_entity") as get_response_mock: get_response_mock.return_value = {"status": "success", "response": "Test response"}