Skip to content

Commit 675ceb2

Browse files
author
zach
authored
fix: chat response handling (#24)
1 parent 84934b5 commit 675ceb2

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

mcpx_py/__main__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,14 @@ async def chat_loop(chat):
9898
if isinstance(part, pydantic_ai.messages.TextPart):
9999
print(part.content)
100100
elif isinstance(part, pydantic_ai.messages.ToolCallPart):
101+
args = part.args
102+
if isinstance(args, str):
103+
args = json.loads(args)
101104
if part.tool_name == "final_result":
102-
print(part.args["response"])
105+
print(args["response"])
103106
else:
104107
print(
105-
f">> Tool: {part.tool_name} ({part.tool_call_id}) input={part.args}"
108+
f">> Tool: {part.tool_name} ({part.tool_call_id}) input={args}"
106109
)
107110
except Exception:
108111
print("\nERROR>>", traceback.format_exc())

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mcpx-py"
3-
version = "0.5.1"
3+
version = "0.5.2"
44
description = "An mcp.run client for Python"
55
readme = "README.md"
66
requires-python = ">=3.12"

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)