Skip to content

mcpcompat shim normalizes tool schemas, dropping properties when type:object is absent #5770

Closed as duplicate

Description

@JAORMX

Context

While writing regression tests for the mcp-go → go-sdk migration (#5742), a tool schema fidelity regression was discovered in github.com/stacklok/toolhive-core/mcpcompat v0.0.27.

Finding

The shim's normalizeObjectSchema replaces tool input schemas that lack a top-level "type":"object" with a bare {"type":"object"}, dropping properties, required, and any other fields.

For example, a backend tool with inputSchema: {"properties": {"x": {"type": "string"}}, "required": ["x"]} (no top-level type) is projected as {"type":"object"} — the properties and required fields are lost.

Impact: Clients lose the ability to validate tool arguments or present input forms. The tool's input schema is effectively erased.

This is tracked as finding U6 in stacklok/toolhive-core#156.

Regression test coverage

  • TestRegression_ToolSchemaWithoutTypeObject_NormalizedToEmptyObject in pkg/vmcp/server/schema_fidelity_regression_test.go — pins the current (lossy) behavior. When the shim is fixed, the assertion should be flipped to verify the schema is projected intact.
  • TestRegression_ToolSchemaWithTypeObject_ProjectedIntact — verifies schemas WITH type:object ARE projected verbatim (this passes today).

MCP spec reference

MCP 2025-11-25 §"Tool Definition": inputSchema SHOULD be a JSON Schema object. The server should pass schemas through verbatim without normalizing or injecting missing keys.

Acceptance criteria

When the shim is fixed:

  • A tool whose input schema lacks "type":"object" should be projected with its schema intact (properties, required, etc. preserved)
  • The regression test should be updated to assert the correct behavior

Activity

  1. added
    needs-triage
    on Jul 9, 2026
  2. aponcedeleonch commented on Jul 13, 2026

    @aponcedeleonch
    Member

    Duplicate: #5769

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions