Commit 8a04896
fix(mcp): rename wire fields to contract names before dispatch (#3215)
* fix(mcp): rename wire fields to contract names before dispatch
The MCP wire schema (generated from apps/cli operation params) exposes
PARAM_FLAG_OVERRIDES renames such as `commentId` → `id` and
`parentCommentId` → `parentId`. Without an inverse translation at
dispatch time, the contract validator rejects the wire field names
because it expects the canonical contract names — so
`superdoc_comment` actions `delete`/`get`/`update` fail with
`comments.<action> commentId must be a non-empty string` even when the
caller follows the documented schema.
The CLI applies the inverse rename in extractInvokeInput()
(apps/cli/src/lib/invoke-input.ts PARAM_RENAMES). This commit adds the
matching layer for the MCP path: a small `applyParamRenames` helper in
a standalone module, applied in `executeOperation` immediately before
`api.invoke`.
Affected operations: comments.create (parentId → parentCommentId),
comments.patch / comments.delete / comments.get (id → commentId),
getNodeById (id → nodeId).
Includes unit tests for the rename helper.
* review: fix comment count/style and document output-rename asymmetry
- param-renames.ts: fix "Three" → "Five" (5 operations, not 3) and
replace em-dash per style rule (caio-pizzol review suggestion).
- intent.ts: add AIDEV-NOTE explaining why input renames are not
inverted on output — canonical names in responses are usable directly,
so inverting adds complexity for no practical benefit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* review: clarify output-rename asymmetry is incidental, not deliberate
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Caio Pizzol <97641911+caio-pizzol@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent cb1330a commit 8a04896
3 files changed
Lines changed: 86 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments