Skip to content

fix: omit empty tools array from provider requests - #361

Open
LyricalNanoha wants to merge 1 commit into
leookun:mainfrom
LyricalNanoha:fix/omit-empty-tools-array
Open

fix: omit empty tools array from provider requests#361
LyricalNanoha wants to merge 1 commit into
leookun:mainfrom
LyricalNanoha:fix/omit-empty-tools-array

Conversation

@LyricalNanoha

Copy link
Copy Markdown

Summary

  • vLLM and some OpenAI-compatible APIs reject requests containing an empty tools: [] array with 400 Bad Request
  • The model connectivity test sends no tools, causing the test to fail against vLLM servers
  • Conditionally include the tools field in request bodies only when tools are present, across all three providers (OpenAI Chat, OpenAI Responses, Anthropic)

Error reproduced

连通性测试失败:provider error: OpenAI Chat 400 Bad Request: {"error":{"message":"`tools` must not be an empty array. Either provide at least one tool or omit the field entirely. (parameter=tools)","type":"BadRequestError","param":"tools","code":400}}

Test plan

  • cargo check passes
  • All existing connectivity tests pass (cargo test -p cursor-server connectivity)
  • Manual verification: configure a vLLM endpoint and run the model connectivity test

vLLM and some OpenAI-compatible APIs reject requests containing an
empty `tools: []` array with a 400 Bad Request. This affects the
model connectivity test which sends no tools. Instead of always
including the tools field, conditionally add it only when tools are
present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant