adcp 1.4.0__py3-none-any.whl → 1.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- adcp/__init__.py +1 -1
- adcp/protocols/mcp.py +38 -16
- {adcp-1.4.0.dist-info → adcp-1.4.1.dist-info}/METADATA +1 -1
- {adcp-1.4.0.dist-info → adcp-1.4.1.dist-info}/RECORD +8 -8
- {adcp-1.4.0.dist-info → adcp-1.4.1.dist-info}/WHEEL +0 -0
- {adcp-1.4.0.dist-info → adcp-1.4.1.dist-info}/entry_points.txt +0 -0
- {adcp-1.4.0.dist-info → adcp-1.4.1.dist-info}/licenses/LICENSE +0 -0
- {adcp-1.4.0.dist-info → adcp-1.4.1.dist-info}/top_level.txt +0 -0
adcp/__init__.py
CHANGED
adcp/protocols/mcp.py
CHANGED
|
@@ -245,24 +245,12 @@ class MCPAdapter(ProtocolAdapter):
|
|
|
245
245
|
# Call the tool using MCP client session
|
|
246
246
|
result = await session.call_tool(tool_name, params)
|
|
247
247
|
|
|
248
|
-
#
|
|
249
|
-
|
|
250
|
-
# response data must be in structuredContent
|
|
251
|
-
if not hasattr(result, "structuredContent") or result.structuredContent is None:
|
|
252
|
-
raise ValueError(
|
|
253
|
-
f"MCP tool {tool_name} did not return structuredContent. "
|
|
254
|
-
f"This SDK requires MCP tools to provide structured responses. "
|
|
255
|
-
f"Got content: {result.content if hasattr(result, 'content') else 'none'}"
|
|
256
|
-
)
|
|
248
|
+
# Check if this is an error response
|
|
249
|
+
is_error = hasattr(result, "isError") and result.isError
|
|
257
250
|
|
|
258
|
-
# Extract
|
|
259
|
-
data_to_return = result.structuredContent
|
|
260
|
-
|
|
261
|
-
# Extract human-readable message from content (optional)
|
|
262
|
-
# This is typically a status message like "Found 42 creative formats"
|
|
251
|
+
# Extract human-readable message from content
|
|
263
252
|
message_text = None
|
|
264
253
|
if hasattr(result, "content") and result.content:
|
|
265
|
-
# Serialize content using the same method used for backward compatibility
|
|
266
254
|
serialized_content = self._serialize_mcp_content(result.content)
|
|
267
255
|
if isinstance(serialized_content, list):
|
|
268
256
|
for item in serialized_content:
|
|
@@ -271,6 +259,40 @@ class MCPAdapter(ProtocolAdapter):
|
|
|
271
259
|
message_text = item["text"]
|
|
272
260
|
break
|
|
273
261
|
|
|
262
|
+
# Handle error responses
|
|
263
|
+
if is_error:
|
|
264
|
+
# For error responses, structuredContent is optional
|
|
265
|
+
# Use the error message from content as the error
|
|
266
|
+
error_message = message_text or "Tool execution failed"
|
|
267
|
+
if self.agent_config.debug and start_time:
|
|
268
|
+
duration_ms = (time.time() - start_time) * 1000
|
|
269
|
+
debug_info = DebugInfo(
|
|
270
|
+
request=debug_request,
|
|
271
|
+
response={
|
|
272
|
+
"error": error_message,
|
|
273
|
+
"is_error": True,
|
|
274
|
+
},
|
|
275
|
+
duration_ms=duration_ms,
|
|
276
|
+
)
|
|
277
|
+
return TaskResult[Any](
|
|
278
|
+
status=TaskStatus.FAILED,
|
|
279
|
+
error=error_message,
|
|
280
|
+
success=False,
|
|
281
|
+
debug_info=debug_info,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
# For successful responses, structuredContent is required
|
|
285
|
+
if not hasattr(result, "structuredContent") or result.structuredContent is None:
|
|
286
|
+
raise ValueError(
|
|
287
|
+
f"MCP tool {tool_name} did not return structuredContent. "
|
|
288
|
+
f"This SDK requires MCP tools to provide structured responses "
|
|
289
|
+
f"for successful calls. "
|
|
290
|
+
f"Got content: {result.content if hasattr(result, 'content') else 'none'}"
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
# Extract the structured data (required for success)
|
|
294
|
+
data_to_return = result.structuredContent
|
|
295
|
+
|
|
274
296
|
if self.agent_config.debug and start_time:
|
|
275
297
|
duration_ms = (time.time() - start_time) * 1000
|
|
276
298
|
debug_info = DebugInfo(
|
|
@@ -278,7 +300,7 @@ class MCPAdapter(ProtocolAdapter):
|
|
|
278
300
|
response={
|
|
279
301
|
"data": data_to_return,
|
|
280
302
|
"message": message_text,
|
|
281
|
-
"is_error":
|
|
303
|
+
"is_error": False,
|
|
282
304
|
},
|
|
283
305
|
duration_ms=duration_ms,
|
|
284
306
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
adcp/__init__.py,sha256=
|
|
1
|
+
adcp/__init__.py,sha256=zV1J1z4uR1C7rGIccifeDGjN8pnZI1o280FioRvwRLM,6976
|
|
2
2
|
adcp/__main__.py,sha256=Avy_C71rruh2lOuojvuXDj09tkFOaek74nJ-dbx25Sw,12838
|
|
3
3
|
adcp/client.py,sha256=4qoFNDT5swzi4w5bnWJ5nVTG5JIL0xnLJOJMGeMyci4,28412
|
|
4
4
|
adcp/config.py,sha256=Vsy7ZPOI8G3fB_i5Nk-CHbC7wdasCUWuKlos0fwA0kY,2017
|
|
@@ -7,7 +7,7 @@ adcp/simple.py,sha256=FgPYWT32BNXkQz07r2x2gXgOmOikWLi88SzN5UIVSiU,10440
|
|
|
7
7
|
adcp/protocols/__init__.py,sha256=6UFwACQ0QadBUzy17wUROHqsJDp8ztPW2jzyl53Zh_g,262
|
|
8
8
|
adcp/protocols/a2a.py,sha256=FHgc6G_eU2qD0vH7_RyS1eZvUFSb2j3-EsceoHPi384,12467
|
|
9
9
|
adcp/protocols/base.py,sha256=vBHD23Fzl_CCk_Gy9nvSbBYopcJlYkYyzoz-rhI8wHg,5214
|
|
10
|
-
adcp/protocols/mcp.py,sha256=
|
|
10
|
+
adcp/protocols/mcp.py,sha256=d9uSpGd0BKvQ0JxztkfDvHwoDrDYhuiw5oivpYOAbmM,16647
|
|
11
11
|
adcp/testing/__init__.py,sha256=ZWp_floWjVZfy8RBG5v_FUXQ8YbN7xjXvVcX-_zl_HU,1416
|
|
12
12
|
adcp/testing/test_helpers.py,sha256=4n8fZYy1cVpjZpFW2SxBzpC8fmY-MBFrzY4tIPqe4rQ,10028
|
|
13
13
|
adcp/types/__init__.py,sha256=3E_TJUXqQQFcjmSZZSPLwqBP3s_ijsH2LDeuOU-MP30,402
|
|
@@ -18,9 +18,9 @@ adcp/utils/__init__.py,sha256=uetvSJB19CjQbtwEYZiTnumJG11GsafQmXm5eR3hL7E,153
|
|
|
18
18
|
adcp/utils/operation_id.py,sha256=wQX9Bb5epXzRq23xoeYPTqzu5yLuhshg7lKJZihcM2k,294
|
|
19
19
|
adcp/utils/preview_cache.py,sha256=8_2qs5CgrHv1_WOnD4bs43VWueu-rcZRu5PZMQ_lyuE,17573
|
|
20
20
|
adcp/utils/response_parser.py,sha256=uPk2vIH-RYZmq7y3i8lC4HTMQ3FfKdlgXKTjgJ1955M,6253
|
|
21
|
-
adcp-1.4.
|
|
22
|
-
adcp-1.4.
|
|
23
|
-
adcp-1.4.
|
|
24
|
-
adcp-1.4.
|
|
25
|
-
adcp-1.4.
|
|
26
|
-
adcp-1.4.
|
|
21
|
+
adcp-1.4.1.dist-info/licenses/LICENSE,sha256=PF39NR3Ae8PLgBhg3Uxw6ju7iGVIf8hfv9LRWQdii_U,629
|
|
22
|
+
adcp-1.4.1.dist-info/METADATA,sha256=Y2iI6jHEWqkxqXSHHv5m2NX2OHet5KyEIPktdlNfOJo,19931
|
|
23
|
+
adcp-1.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
adcp-1.4.1.dist-info/entry_points.txt,sha256=DQKpcGsJX8DtVI_SGApQ7tNvqUB4zkTLaTAEpFgmi3U,44
|
|
25
|
+
adcp-1.4.1.dist-info/top_level.txt,sha256=T1_NF0GefncFU9v_k56oDwKSJREyCqIM8lAwNZf0EOs,5
|
|
26
|
+
adcp-1.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|