MCP: viewmodel_editor request-schema validation


FOR TLDR, scroll all the way down

🟩 OVERVIEW

HTTP MCP server: viewmodel_editor property creation rejected by request-schema validation(oneOf with an enum-discriminated branch fails to discriminate

Over the HTTP JSON-RPC endpoint, viewmodel_editor rejects every attempt to create ViewModel properties before the tool handler runs. Affected commands:

  • addProperties,

  • createViewModels(with inline viewModelProperties), and

  • createViewModelInstances(with inline instanceProperties).

All three return:

-32602 Invalid arguments for tool 'viewmodel_editor':
JsonSchemaValidationException: Value matches 3 schemas, expected exactly 1 for oneOf (at data addProperties/viewModels/0/viewModelProperties/0)

The handler itself is correct - the same operations succeed for in-processcallers(the in-editor AI agent). Only callers crossing the HTTP JSON-RPCboundary (external MCP clients, curl) are blocked, because the ingress validates arguments against the published inputSchema before dispatch.

The schema would be valid under a correct validator. The defect is in how the ingress validator resolves a oneOf that contains an enum-discriminated branch (details under ROOT CAUSE).


🟩 IMPACT

External MCP automation (any HTTP/JSON-RPC client) cannot author ViewModel properties on this build; they must be created via the in-editor AI agent or by hand in the Data panel. The in-editor agent and the runtime are unaffected. A request-rewriting proxy cannot work around it, because the check is the server's own ingress, which a proxy sits outside of.


🟩 ENVIRONMENT

  • Rive Early Access app 0.8.5035 (build 5022)

  • MCP server serverInfo.name = "rive", version = "0.6"

  • Endpoint: http://127.0.0.1:9791/mcp (streamable HTTP, JSON-RPC 2.0)

  • The endpoint is stateless for tools/call: no initialize handshake and no Mcp-Session-Id are required.

  • Reproduced via external MCP client AND raw curl with identical responses, so the rejection is server-ingress, not client-side.


🟩 STEPS TO REPRODUCE

viewModelId need not exist: schema validation runs before any id lookup, so a placeholder still triggers (or clears) the validation error.

A. The failing case - addProperties (returns -32602):

  curl -sS -X POST http://127.0.0.1:9791/mcp \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json, text/event-stream' \
    -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
          "name":"viewmodel_editor",
          "arguments":{"command":"addProperties","data":{"addProperties":{
          "viewModels":[{"viewModelId":"fake-probe-vm","viewModelProperties":[
          {"name":"slot","propertyType":"number"}]}]}}}}}'

Result:

-32602 "Value matches 3 schemas, expected exactly 1 for oneOf(at data/addProperties/viewModels/0/viewModelProperties/0)"

B. Every propertyType fails identically - including the valid const-branch

values "list" and "viewModel", and even a non-string (7). This proves the value constraints are not enforced for this oneOf:

for PT in '"number"' '"list"' '"viewModel"' '7'; do
   curl -sS -X POST http://127.0.0.1:9791/mcp \
   -H 'Content-Type: application/json' \
      -H 'Accept: application/json, text/event-stream' \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"viewmodel_editor","arguments":{"command":"addProperties","data":{"addProperties":{"viewModels":[{"viewModelId":"fake-probe-vm","viewModelProperties":[{"name":"slot","propertyType":'"$PT"'}]}]}}}}}'
   echo
done

Result: all four return

-32602 "Value matches 3 schemas, expected exactly 1 for oneOf".

C. Same bug on createViewModelInstances (inline instanceProperties):

curl -sS -X POST http://127.0.0.1:9791/mcp \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json, text/event-stream' \
    -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"viewmodel_editor","arguments":{"command":"createViewModelInstances","data":{"createViewModelInstances":{"viewModelId":"fake-probe-vm","instances":[{"name":"inst","instanceProperties":[{"name":"slot","propertyType":"number","value":"5","viewModelPropertyId":"fake-prop-id"}]}]}}}}}'

Result:

-32602 "Value matches 3 schemas, expected exactly 1 for oneOf(at data/createViewModelInstances/instances/0/instanceProperties/0)"

D. Control - path_editor (a pure-const oneOf) PASSES validation.

The bogus parentId makes a passing validation create nothing; the handler-level FormatException proves the arguments cleared schema validation (a validation failure would be -32602 instead):

curl -sS -X POST http://127.0.0.1:9791/mcp \
   -H 'Content-Type: application/json' \
   -H 'Accept: application/json, text/event-stream' \
   -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"path_editor","arguments":{"command":"createShapes","data":{"shapes":[{"name":"Probe","parentId":"nonexistent-probe-id-xyz","paths":[{"name":"P","commands":[{"commandType":"moveTo","x":0,"y":0},{"commandType":"lineTo","x":10,"y":0},{"commandType":"close"}]}],"paints":[{"paintType":"fill","color":"#FFFF0000"}]}]}}}}'

Result (NOT -32602):

"Error creating shapes: FormatException: Invalid radix-10 number (at character 1) nonexistent".

i.e. moveTo+lineTo (distinguished only by const) cleared validation.


🟩 EXPECTED

addProperties / createViewModels / createViewModelInstances with a valid propertyType create the property.

πŸŸ₯ ACTUAL

The HTTP ingress rejects the call with -32602 "Value matches 3 schemas, expected exactly 1 for oneOf" before the handler runs.


🟩 POSSIBLE ROOT CAUSE(observed behaviour)

The viewModelProperties items use this oneOf

branch 1:

{ name: {type:string}, propertyType: { enum: [string, boolean,
color, number, trigger, artboard] } }

branch 2:

{ name: {type:string}, propertyType: { const: "list" } }

branch 3:

{ name: {type:string}, propertyType: { const: "viewModel" },viewModelName: {type:string} }

For this oneOf the validator discards the value constraints and matches all three branches structurally ({ name:string, ... }), so every input matches all three and "exactly 1" is unreachable. Step B above confirms this: number,list, viewModel, and even the non-string 7 all return the identical "matches 3", so neither const (branches 2/3) nor enum (branch 1) is honored here.

This is NOT a blanket "validator ignores const/enum" defect.

The same ingress DOES honor const: path_editor's command oneOf (moveTo / lineTo / cubicTo /close) discriminates purely on const, and step D shows a moveTo+lineTo payload clears validation.

The only structural difference between that working oneOf and the broken one is that branch 1 here uses enum, whereas path_editor's branches all use const.

Best-supported hypothesis(correlation, mechanism not yet proven):

a oneOf that mixes an enum-discriminated branch with const-discriminated branches fails to discriminate and falls back to structural-only matching for the whole oneOf. A pure-const oneOf discriminates correctly. This fits every probe:

  • addProperties(enum + const mix) -> fails, "matches 3"

  • createViewModelInstances(enum + const mix) -> fails, "matches 3"

  • path_editor commands(all const) -> passes validation

No documents were mutated by any probe (bogus parentId / viewModelId ensured validation-only requests).


🟩 SUGGESTED FIX

Two independent fixes;

  1. SCHEMA fix, will unblock cause the bug won’t be hit

  2. VALIDATOR fix, will fix the actual defect.


🍌 Schema: replace the value-discriminated oneOf with a single object whose propertyType is one flat enum of all values(string | boolean | color | number | trigger | artboard | list | viewModel) and make viewModelName optional(or conditionally required via if/then). With no oneOf there is no discrimination step, so the bug cannot be hit. Apply the same to createViewModelInstances.instanceProperties.

πŸ† Validator: the ingress honors const but mishandles a oneOf that contains an enum-discriminated branch, apparently falling back to structural-only matching for the whole oneOf. Fixing enum discrimination(or mixed enum+const oneOf resolution) makes the existing schema valid as-is.

Notes:
Simply adding "type":"string" or "required":["propertyType"] to the branches does NOT work as a schema workaround. Under the observed structural-only fallback the string/number/etc. branch and the list branch stay structurally identical({ name, propertyType }), so they still co-match ("matches 2").

A workaround must either remove the oneOf (recommended) or convert branch 1's enum into individual const branches so the whole oneOf is pure-const like the working path_editor case.


🟩 TLDR

Summary made by forum summarisation ai


Explainer for non-tech ppl:

When sending a request to modify a viewmodel, you will hit a wall.