The anthropic API says that messages of content type tool_use can have only following attributes:

Documentation Link
The MCP client's process_query function tried to check if there is a attribute text in a content block of type == tool_use - which as per the API documentation will not be the case.
|
if hasattr(content, 'text') and content.text: |
|
messages.append({ |
|
"role": "assistant", |
|
"content": content.text |
|
}) |
While API may respond with an array of content blocks, maybe one with type = text, and then the next one with type = tool_use but a content of type tool_use will never have an attribute text.
Let me know if I'm missing something here. If you agree with this, I'd like to fix this.
The anthropic API says that messages of content type
tool_usecan have only following attributes:Documentation Link
The MCP client's
process_queryfunction tried to check if there is a attributetextin acontentblock oftype==tool_use- which as per the API documentation will not be the case.quickstart-resources/mcp-client-python/client.py
Lines 88 to 92 in dfc9247
While API may respond with an array of content blocks, maybe one with
type=text, and then the next one withtype=tool_usebut a content of typetool_usewill never have an attributetext.Let me know if I'm missing something here. If you agree with this, I'd like to fix this.