Skip to content

Commit 26544e6

Browse files
committed
docs: simplify RPC guide error and MCP wording
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.
1 parent 26cf0c5 commit 26544e6

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

docs/content/1.guide/2.rpc.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,7 @@ Scope with your devframe id, then a kebab-case action: `my-devframe:get-modules`
5656

5757
### Handler arguments
5858

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.
6660

6761
### Setup vs handler
6862

@@ -198,15 +192,7 @@ The WS transport picks one of two encoders per function:
198192
| `false` (default) | `structured-clone-es` | `s:` | `Map`, `Set`, `Date`, `BigInt`, cycles, class instances |
199193
| `true` (opt-in) | strict `JSON.stringify` | _(unprefixed)_ | JSON-only |
200194

201-
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.
210196

211197
## Agent exposure
212198

@@ -230,6 +216,8 @@ defineRpcFunction({
230216
})
231217
```
232218

219+
Exposing a function over MCP requires `jsonSerializable: true`.
220+
233221
## What's next
234222

235223
- [Shared State](/guide/shared-state) — state synced across clients

0 commit comments

Comments
 (0)