Files
paseo/REPORT-mcp-jsonrpc-permission-callid.md
T
Mohamed BoudraandClaude Opus 4.5 28514f5b76 Fix Codex MCP file_change tool output and lifecycle events
- Add CustomToolCallOutputSchema to parse custom_tool_call_output events
  from raw_response_item wrappers
- Handle tool output for pending patch changes in handleMcpEvent:
  - Match call_id to pending patch changes
  - Parse JSON output for success/exit_code metadata
  - Emit completed file_change timeline item with files and status
- Add read_file tool name handling in mapRawResponseItemToThreadItem
- Update test expectations for Codex MCP limitations:
  - Skip read_file assertions (Codex doesn't expose separate read tool)
  - Remove web_search output assertion (Codex doesn't return results)

All 13 codex-mcp-agent.test.ts tests now pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 14:32:50 +07:00

21 lines
1.2 KiB
Markdown

# MCP JSONRPC permission call_id error
## Summary
- Observed JSONRPC error during `npm run test --workspace=@paseo/server`:
- `permission call_id provided multiple times (codex_call_id, codex_mcp_tool_call_id, codex_event_id)`
- Error originates from the Codex MCP elicitation request handler in `packages/server/src/server/agent/providers/codex-mcp-agent.ts`.
## Root Cause
- `PermissionParamsSchema` used an exclusive resolver for `call_id`, rejecting payloads that include multiple call-id aliases.
- The Codex MCP server sends permission params with multiple call-id fields at once and they are **not identical**:
- Example from `scripts/codex-mcp-elicitation-test.ts` (on-request): `codex_call_id = "call_..."`, `codex_mcp_tool_call_id = "2"`, `codex_event_id = "2"`.
- The exclusive resolver raised a Zod error, surfaced as the MCP JSONRPC error in tests.
## Fix
- Added `resolvePreferredString` to select the canonical permission call id in a priority order.
- Updated `PermissionParamsSchema` to prefer `codex_call_id` when present, falling back to `codex_mcp_tool_call_id`, `codex_event_id`, then `call_id`.
## Files
- `packages/server/src/server/agent/providers/codex-mcp-agent.ts`
- `REPORT-mcp-jsonrpc-permission-callid.md`