Skip to content

Issue with tool calls #184

@mattmas

Description

@mattmas

Just tried the package today, but ran into a problem when calling an MCP tool:

{"type":"error","error":{"type":"invalid_request_error","message":"messages.8.content.0: unexpected tool_use_id found in tool_result blocks: toolu_01NGSZ6A8jPBzZr8prgLzR7P. Each tool_result block must have a corresponding tool_use block in the previous message."},"request_id":"req_011CYByzUedawPRMujMEod1a"}

This comes back from Anthropic, but it seems like an issue with how the messages are built?

Claude says:

The API requires this strict pattern:

  1. Assistant message contains a tool_use block with an id
  2. Next user message contains a tool_result block whose tool_use_id matches that id

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions