[BUG] MCP x-mcp-header confuses dotted property names with nested paths

Author: aravelo7Created Sep 23, 2026Updated Sep 23, 2026
Labelsbug

Describe the bug

When an MCP tool parameter annotated with x-mcp-header contains a literal . in its JSON property name, LangChain4j treats the dot as a nested-property separator.

For example, a top-level property named config.region can be confused with a nested config -> region property during MCP parameter header lookup.

As a result, LangChain4j may send the wrong value in the corresponding Mcp-Param-* HTTP header.

Log and Stack trace

Not applicable. No exception or stack trace is produced; the incorrect header value is sent silently.

To Reproduce

Use an MCP tool schema containing both a literal dotted property and a nested property:

json
{
  "type": "object",
  "properties": {
    "config.region": {
      "type": "string",
      "x-mcp-header": "Region"
    },
    "config": {
      "type": "object",
      "properties": {
        "region": {
          "type": "string"
        }
      }
    }
  }
}

Then execute the tool with arguments such as:

json
{
  "config.region": "literal",
  "config": {
    "region": "nested"
  }
}

The current implementation resolves the annotated property through a dot-separated property path. In this case, the Mcp-Param-Region header is populated with:

nested

instead of the value of the literal top-level property:

literal

This is reproducible on the current main branch at commit b30925e.

Expected behavior

A literal JSON property named config.region should be distinguished from a nested config -> region property.

The corresponding Mcp-Param-Region header should contain:

literal

Please complete the following information:

  • LangChain4j version: current main (b30925e)
  • LLM(s) used: N/A
  • Java version: OpenJDK 21.0.11 (Temurin)
  • Spring Boot version (if applicable): N/A

Additional context

A regression test against the current implementation reproduces the issue consistently: the expected header value is literal, while the actual value is nested.

The issue is specific to MCP x-mcp-header parameter resolution and does not depend on any LLM provider.