bug: Serper MCP Server - 400
Version: 0.7.1
Describe the Bug
Under Settings -> MCP Server -> serper I just added my API key. I am also successfully running claude-sonnet-4-5-20250929 and gpt 4.1 as cloud model providers. Serper introduces two mcp tools: google_search and scrape. However they fail every second time with an error like:
400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5:
tool_useids were found withouttool_resultblocks immediately after: toolu_01VHeN2vzPPs5dS4zo1Mvpfr. Eachtool_useblock must have a correspondingtool_resultblock in the next message."},"request_id":"req_011CU7hTSPLHRESG6CmyUpzs"}
or
400 {"type":"error","error":{"type":"invalid_request_error","message":"messages: text content blocks must be non-empty"},"request_id":"req_011CU7iMhCkzkGp8Lnr13FpF"}
What I encounterd is that this mostly happens, when two tools are called at the same time. At least, it seems as both tools have a loading spinner. If a tool is called alone, i did not encountered an error so far.
Steps to Reproduce
- Add your keys for serper and cloud provider
- activate
- type something like "Can you find information about a person called "Toni Fetzer"? What is his profession? is he legit?"
- wait for tool call
- see screenshot below
Screenshots / Logs
Operating System
- [ ] MacOS
- [x] Windows (11)
- [ ] Linux
This is really strange, there shouldn't be 2 tool call at the same time
Let me try to verify this
See video for verification:
https://github.com/user-attachments/assets/6d63f575-b7f4-47f6-973a-24e5179dc22e
FTR: Nothing in the logs.
@LazyYuuki out of curiosity, did you found something?
Hey @Antidote00 this is a problem with Claude endpoint specifically, we didn't anticipate this, so right now a fix is just to avoid Claude model first, sorry for the problem
Using GPT4.1 i get the following error:
400 An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_j3kBozRnTwaiBZnvnL7jmeHS, call_TesbEhWDZbOdkwEouChr7ok8
with the same steps as described above. Scrape was called 3 times similtanouesly.
Does not seem to be an Claude endpoint problem imo.
I'm also running into these errors with Claude and GPT.
I didn't test this thoroughly, but adding this to my prompt helps: please only call one tool at a time.
@mpfz0r thanks for the tip. It helps that i will not run into this all the time and I can for now work with this.
@LazyYuuki I still think that could be solved inside jan.ai, as i do not encounter this problem using 5ire, librechat or chatbox.
I'm also running into this error with Claude(haiku and sonnet). Even though I've already inserted this into prompt, "Use one tool at a time" doesn't seem to have helped me much.
# WHEN USING TOOLS
- Use one tool at a time and wait for results
- Use actual values as arguments, not variable names
- Learn from each result before deciding next steps
- Avoid repeating the same tool call with identical parameters