jan icon indicating copy to clipboard operation
jan copied to clipboard

bug: Serper MCP Server - 400

Open Antidote00 opened this issue 2 months ago • 7 comments

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_use ids were found without tool_result blocks immediately after: toolu_01VHeN2vzPPs5dS4zo1Mvpfr. Each tool_use block must have a corresponding tool_result block 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

  1. Add your keys for serper and cloud provider
  2. activate
  3. type something like "Can you find information about a person called "Toni Fetzer"? What is his profession? is he legit?"
  4. wait for tool call
  5. see screenshot below

Screenshots / Logs

Image First tool call is a success, the second calls of `scrape` are at the same time, fails.

Operating System

  • [ ] MacOS
  • [x] Windows (11)
  • [ ] Linux

Antidote00 avatar Oct 14 '25 20:10 Antidote00

This is really strange, there shouldn't be 2 tool call at the same time

Let me try to verify this

LazyYuuki avatar Oct 15 '25 02:10 LazyYuuki

See video for verification:

https://github.com/user-attachments/assets/6d63f575-b7f4-47f6-973a-24e5179dc22e

FTR: Nothing in the logs.

Antidote00 avatar Oct 15 '25 06:10 Antidote00

@LazyYuuki out of curiosity, did you found something?

Antidote00 avatar Oct 22 '25 07:10 Antidote00

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

LazyYuuki avatar Oct 22 '25 13:10 LazyYuuki

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.

Image

Does not seem to be an Claude endpoint problem imo.

Antidote00 avatar Oct 22 '25 13:10 Antidote00

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 avatar Oct 27 '25 16:10 mpfz0r

@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.

Antidote00 avatar Nov 01 '25 09:11 Antidote00

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

blacksheepaul avatar Nov 28 '25 04:11 blacksheepaul