GitHub Repo
Dify Community Proposes MCP Union-Type Fix After Valid Array Parameters May Be Converted to Strings
A Dify community report on October 16 says that when MCP tool parameters accept both strings and arrays, valid arrays may be converted to Python representation strings, causing tool queries to fail. The proposed fix preserves types and adds regression tests, but has not yet been merged or officially released.

On October 16, the Dify community proposed an interoperability fix for MCP tools: when a parameter allows multiple JSON types, the framework may first reduce it to a single type and then rewrite valid input at runtime. The reporter used a self-hosted Docker deployment of Dify 1.16.1 and said the same issue was present on the main branch at the time. So far, the evidence comes from a public reproduction and a proposed fix; maintainers have yet to confirm the scope of impact. Issue report
The reproduction connects to the built-in MCP service in Home Assistant 2026.9. Its GetLiveContext tool allows domain to accept either a string or an array of strings. But after the model passes {"domain":["light"]}, Dify sends the value as the string "['light']", and the service responds that it cannot find entities for the corresponding domain. The reporter said direct calls to the service succeed with either a string or an array. Reproduction steps Home Assistant’s official documentation confirms that this MCP integration lets agents retrieve current state and call tools, so incorrect parameter passing can impair an agent’s ability to obtain information about its environment. Official documentation
According to the proposal’s analysis, the problem occurs in two stages: schema conversion selects only the first non-null branch of a union type, so the model sees an incomplete parameter definition; at runtime, the framework then coerces the value to the selected type, applying str() to the array. The technical implication is that even when a model produces a parameter that matches the original definition, the intermediary framework may still change its meaning. Debugging therefore requires checking the value actually sent to the tool. Fix analysis
PR #44182 proposes preserving the original schema for multi-type parameters and passing these MCP parameters through directly for server-side validation, while retaining the existing conversion for single-type parameters. The author added tests covering three union-type representations, two branch orders, and string and array inputs, and reported that 991 related tests passed. These are the proposal author’s verification results; the PR was still awaiting review when checked. Proposal and tests
Engineering teams should track the merge and release version, and test their own multi-type tool parameters. For a query involving a single domain, the string form verified in the report can temporarily avoid the issue, but it cannot replace calls with arrays for multiple domains. Changing every parameter to an array type is also inadvisable, as it could alter the behavior of other valid inputs. Limitations