You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove the "if X it throws DFxxxx" phrasings from the RPC guide, drop the redundant zod tip and args/returns warning callouts, and fold the MCP jsonSerializable requirement into a single line under the Agent exposure example.
Copy file name to clipboardExpand all lines: docs/content/1.guide/2.rpc.md
+4-16Lines changed: 4 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,13 +56,7 @@ Scope with your devframe id, then a kebab-case action: `my-devframe:get-modules`
56
56
57
57
### Handler arguments
58
58
59
-
Handlers accept any serializable arguments. Declared `args` schemas validate each at the boundary; extra object fields still reach the handler.
60
-
61
-
> [!TIP]
62
-
> If your app already pulls in **zod**, use it for your RPC schemas to reuse a dependency you already ship.
63
-
64
-
> [!WARNING]
65
-
> Declared `args`/`returns` schemas are enforced at runtime; failing arguments or return values are rejected with `DF0043` / `DF0044`.
59
+
Handlers accept any serializable arguments. Declared `args` and `returns` schemas are enforced at runtime; extra object fields still reach the handler.
66
60
67
61
### Setup vs handler
68
62
@@ -198,15 +192,7 @@ The WS transport picks one of two encoders per function:
198
192
|`false` (default) |`structured-clone-es`|`s:`|`Map`, `Set`, `Date`, `BigInt`, cycles, class instances |
When every function is JSON-flagged, the wire stays plain JSON.
202
-
203
-
### Discovering shape errors during dev
204
-
205
-
When a `jsonSerializable: true` handler returns a value JSON cannot round-trip (`Map`, `Date`, …), the strict serializer throws [`DF0020`](/errors/DF0020).
206
-
207
-
### MCP requires JSON
208
-
209
-
`agent: {...}` requires `jsonSerializable: true`; one without the other throws [`DF0019`](/errors/DF0019).
195
+
When every function is JSON-flagged, the wire stays plain JSON. A `jsonSerializable: true` handler must return JSON-only values — `Map`, `Date`, and friends won't round-trip.
210
196
211
197
## Agent exposure
212
198
@@ -230,6 +216,8 @@ defineRpcFunction({
230
216
})
231
217
```
232
218
219
+
Exposing a function over MCP requires `jsonSerializable: true`.
220
+
233
221
## What's next
234
222
235
223
-[Shared State](/guide/shared-state) — state synced across clients
0 commit comments