Skip to content

A potential mistake in the process_query function of the MCP client. #28

@pyaf

Description

@pyaf

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

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions