-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Describe the bug
When Aperag (via mcp_agent) calls a tool and sends the request to a self-hosted vLLM OpenAI-compatible server, the outgoing payload contains messages[*].content as a nested list ([[{...}]]) instead of a string or a flat parts array ([{...}]).
vLLM performs strict schema validation and returns 400 BadRequest:
Message content.0 Input should be a valid dictionary or instance of Content [type=model_type, input_value=[{'text': '{\n "items": ... }\n', 'type': 'text'}], input_type=list]
The exact same payload succeeds against OpenAI or OpenRouter (they likely normalize it). This makes Aperag fail only when the provider is vLLM.
To Reproduce
Steps to reproduce the behavior:
Configure Aperag to use a vLLM OpenAI endpoint (e.g. vllm/vllm-openai).
Use a model that supports tool calling (e.g. openai/gpt-oss-120b) and enable auto tool choice.
Trigger any tool call (e.g. a simple “list_collections” or similar).
Observe Aperag sending a request where messages[0].content is [[{ "type":"text","text": "..." }]] (double-wrapped).
vLLM responds with 400 and the Pydantic message shown above.
Screenshots & Logs
`Error code: 400 - {'error': {'message': '1 validation error for
Message
content.0
Input should be a valid dictionary or instance of Content
[type=model_type, input_value=[{'text': '{\n "items": ... }\n}',
'type': 'text'}], input_type=list]
... ', 'type': 'BadRequestError', 'code': 400}}
[INFO] ... Requesting tool call
... "tool_name": "list_collections"
... "GET /api/v1/collections" 200
... then 400 from vLLM as above
`