Skip to content

list_backtests fails: parameterSet is [] but MCP model expects dict #50

@npschweizer

Description

@npschweizer

Summary

list_backtests fails with Pydantic validation errors on BacktestSummaryResponse.parameterSet.
The API returns parameterSet: [] but the MCP model expects a dict, so deserialization fails for every backtest.


Environment

  • MCP image: mcp/quantconnect:latest
  • Host OS: macOS (Apple Silicon / Intel) – macOS VERSION_HERE
  • Docker: 29.2.0
  • Client: OpenCode / MCP host using this config:
"mcp": {
  "quantconnect": {
    "type": "local",
    "command": [
      "docker",
      "run",
      "-i",
      "--rm",
      "-e", "QUANTCONNECT\_USER\_ID",
      "-e", "QUANTCONNECT\_API\_TOKEN",
      "-e", "QUANTCONNECT\_ORGANIZATION\_ID",
      "mcp/quantconnect"
    ],
    "enabled": true,
    "environment": {
      "QUANTCONNECT\_USER\_ID": "{env:QUANTCONNECT\_USER\_ID}",
      "QUANTCONNECT\_API\_TOKEN": "{env:QUANTCONNECT\_API\_TOKEN}",
      "QUANTCONNECT\_ORGANIZATION\_ID": "{env:QUANTCONNECT\_ORGANIZATION\_ID}"
    }
  }
}

Steps to Reproduce

Start the QuantConnect MCP server via Docker, either via the MCP host using the config above, or manually with: docker run -it --rm \
-e QUANTCONNECT_USER_ID=YOUR_ID \
-e QUANTCONNECT_API_TOKEN=YOUR_TOKEN \
-e QUANTCONNECT_ORGANIZATION_ID=YOUR_ORG \
mcp/quantconnect

From the MCP client, call the list_backtests tool for a project that has existing backtests (for example, project ID PROJECT_ID_HERE).
Observe the tool failure in the client logs.

Actual Behavior
The tool call fails with Pydantic validation errors. Exact error from the client:
Error executing tool list_backtests: 88 validation errors for BacktestSummaryResponse
backtests.0.parameterSet.ParameterSet1
Input should be a valid dictionary or instance of ParameterSet1 [type=model_type, input_value=[], input_type=list]
backtests.0.parameterSet.dict[str,union[str,float,int]]
Input should be a valid dictionary [type=dict_type, input_value=[], input_type=list]
[... similar errors for backtests 1-43 ...]
The server successfully retrieved 44 backtests (IDs 0-43), but cannot deserialize the parameterSet field for any of them due to malformed data format in the API response.

From this it appears:
The QuantConnect API (or MCP bridge) is returning parameterSet: [] for each backtest.
The MCP Pydantic model expects parameterSet to be a dict[str, Union[str, float, int]] (or ParameterSet1), so an empty list fails validation.
Expected Behavior
Either:
parameterSet should be returned as {} (an empty dict) when there are no parameters, or
The MCP model should accept list/None for empty parameterSet values.
list_backtests should succeed and return the list of backtests even when they have no parameters.
Additional Notes
The server does successfully fetch 44 backtests; only deserialization of parameterSet fails.
Pulling mcp/quantconnect:latest again confirms the image is up to date; the issue persists.

Happy to provide more logs or try a patched image if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions