Skip to content

Commit 6bf6d66

Browse files
authored
Merge pull request #81 from universal-tool-calling-protocol/dev
Fix bug in mcp plugin
2 parents 1d1c3a7 + 5f25643 commit 6bf6d66

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

plugins/communication_protocols/mcp/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "utcp-mcp"
7-
version = "1.1.0"
7+
version = "1.1.2"
88
authors = [
99
{ name = "UTCP Contributors" },
1010
]

plugins/communication_protocols/mcp/src/utcp_mcp/mcp_communication_protocol.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ async def register_manual(self, caller: 'UtcpClient', manual_call_template: Call
194194
utcp_tool = Tool(
195195
name=mcp_tool.name,
196196
description=mcp_tool.description,
197-
input_schema=mcp_tool.inputSchema,
198-
output_schema=mcp_tool.outputSchema,
197+
inputs=mcp_tool.inputSchema,
198+
outputs=mcp_tool.outputSchema,
199199
tool_call_template=manual_call_template
200200
)
201201
all_tools.append(utcp_tool)
@@ -212,12 +212,12 @@ async def register_manual(self, caller: 'UtcpClient', manual_call_template: Call
212212
resource_tool = Tool(
213213
name=f"{server_name}.resource_{mcp_resource.name}",
214214
description=f"Read resource: {mcp_resource.description or mcp_resource.name}. URI: {mcp_resource.uri}",
215-
input_schema={
215+
inputs={
216216
"type": "object",
217217
"properties": {},
218218
"required": []
219219
},
220-
output_schema={
220+
outputs={
221221
"type": "object",
222222
"properties": {
223223
"contents": {
@@ -384,12 +384,15 @@ async def call_tool_streaming(self, caller: 'UtcpClient', tool_name: str, tool_a
384384
def _process_tool_result(self, result, tool_name: str) -> Any:
385385
self._log_info(f"Processing tool result for '{tool_name}', type: {type(result)}")
386386

387-
# Check for structured output first
388-
if hasattr(result, 'structured_output'):
389-
self._log_info(f"Found structured_output: {result.structured_output}")
390-
return result.structured_output
387+
# Check for structured output first - this is the expected behavior
388+
if hasattr(result, 'structuredContent'):
389+
self._log_info(f"Found structuredContent: {result.structuredContent}")
390+
# If structuredContent has a 'result' key, unwrap it
391+
if isinstance(result.structuredContent, dict) and 'result' in result.structuredContent:
392+
return result.structuredContent['result']
393+
return result.structuredContent
391394

392-
# Process content if available
395+
# Process content if available (fallback)
393396
if hasattr(result, 'content'):
394397
content = result.content
395398
self._log_info(f"Content type: {type(content)}")
@@ -427,6 +430,10 @@ def _process_tool_result(self, result, tool_name: str) -> Any:
427430

428431
return content
429432

433+
# Handle dictionary with 'result' key
434+
if isinstance(result, dict) and 'result' in result:
435+
return result['result']
436+
430437
# Fallback to result attribute
431438
if hasattr(result, 'result'):
432439
return result.result

plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ async def test_http_list_output(
154154

155155
assert isinstance(result, list)
156156
assert len(result) == 3
157-
assert result[0] == "item_0"
158-
assert result[1] == "item_1"
159-
assert result[2] == "item_2"
157+
assert result == ["item_0", "item_1", "item_2"]
160158

161159

162160
@pytest.mark.asyncio

0 commit comments

Comments
 (0)