Claude API Tool Handling Issue in Self-Hosted Version

I've identified an issue with Claude API tool handling in the self-hosted version of Typing Mind. The issue appears to be related to recent changes in Anthropic's API requirements for handling tooluse and toolresult blocks.

Issue Details:

When using Claude models in the self-hosted version, I receive the following error when attempting to use tools:

Request failed. Error details: messages.3: tool_use ids were found without tool_result blocks immediately after: toolu_01[…]. Each tool_use block must have a corresponding tool_result block in the next message.

Troubleshooting Steps Taken:

Verified the issue occurs consistently with Claude models but not with other models

Confirmed the official Typing Mind website works correctly with the same API key

Checked network requests in browser developer tools:

Found Claude correctly sends a tool_use event

The follow-up request doesn't include the proper tool_result format

Tested direct API calls to confirm Anthropic's requirements

Verified network connectivity and firewall settings

Tried different browsers and clearing cache

Reinstalled the application from the GitHub repository

Environment:

macOS (latest version)

Self-hosted Typing Mind from GitHub repository

Claude API key with proper permissions

http-server version 14.1.1

Node.js version 20.x

Conclusion:

This issue appears to be due to a recent change in Anthropic's API requirements for tool handling that hasn't yet been incorporated into the self-hosted version. The official website works correctly, suggesting an update is available but hasn't been pushed to the GitHub repository.

It would be greatly appreciated if you could update the self-hosted version to match the current Claude API requirements for handling tool calls.

Thank you for your excellent product!

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
πŸ’‘

Feature Request

Tags

Plugins

Date

11 months ago

Subscribe to post

Get notified by email when there are changes.