Skip to content

Tool schema for create_container fails VS Code validation: array type must have items #46

@AlisaYuki

Description

@AlisaYuki

Summary

Using mcp-server-docker via MCP in VS Code fails when validating tool mcp_docker_create_container with error:

Error: tool parameters array type must have items

Environment

  • OS: Windows
  • MCP client: VS Code (GitHub Copilot MCP integration)
  • Server launch: uvx mcp-server-docker
  • Package version: mcp-server-docker==0.2.1 (PyPI)

Reproduction

  1. Configure MCP server:
"docker": {
  "command": "uvx",
  "args": ["mcp-server-docker"]
}
  1. Start VS Code MCP and validate tools.
  2. Validation fails for tool mcp_docker_create_container with message above.

Root cause

CreateContainerInput.model_json_schema() emits a tuple branch under ports:

{
  "type": "array",
  "prefixItems": [{"type":"string"},{"type":"integer"}],
  "minItems": 2,
  "maxItems": 2
}

This branch has no items, and some clients require items for all type: array schemas.

Field definition appears to be:

ports: dict[str, int | list[int] | tuple[str, int] | None] | None

Suggested fix

Use a client-compatible schema for that union branch, e.g. avoid tuple in tool input schema or provide explicit JSON schema override with items included for array branches.

Potential options:

  • Replace tuple[str, int] with an object form like { "host": string, "port": int } for MCP input schema.
  • Or define json_schema_extra for the field to ensure all array branches include items.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions