Skip to content

CLI: generic mcp call exits 0 for isError:true tool results #127

Open

Description

@sapph1re

The generic calle mcp call get_call_run route reports exit code 0 and top-level ok: true for an MCP tool result with isError: true. The dedicated calle call status route reports the same failed lookup with exit code 1 and ok: false.

Reproduced against commit 4a53b01ec92cbe9ccae506bd9ea77935a73f3bf7, CLI 0.5.1/core 0.3.1, Node v22.23.2. The raw nested result.isError is preserved, but shell automation checking exit status or top-level ok can take its success branch incorrectly.

Reproduction, complete before/after results and minimal patch.

The fixture injects an HTTP 200 JSON-RPC response containing result: { isError: true, content: [{ type: 'text', text: 'Fixture status lookup failed' }] }. It exercises both CLI routes against tool success, tool failure and JSON-RPC failure. Only generic MCP + tool failure signals success before the patch. All six cases behave consistently after checking result?.isError === true, setting top-level ok accordingly and returning exit code 1 for a failed tool.

No real API calls, phone calls or credentials were used. The fixture blocks global network access, disables telemetry and browser access, and deletes its synthetic temporary cache. This is an offline command-signaling report, separate from SSE parsing issue #110.

Suggested documentation addition: show how HTTP/JSON-RPC transport success, tool execution success and the call lifecycle state differ, including the exit code for each. A successful status lookup does not necessarily mean a successful telephone call.

Prepared with OpenAI Codex assistance for Roman Vinogradov. The reproduction and patched control cases were executed locally.

Activity

  1. Ray-56 commented on Sep 14, 2026

    @Ray-56
    Collaborator

    Priority: P1 — command signaling can send automation down the wrong branch around real-call tools.

    The reproduction confirms that HTTP/JSON-RPC success and MCP tool success are currently conflated by generic calle mcp call. Returning exit 0 and top-level ok: true for isError: true can make an agent proceed after a failed plan/status request or make unsafe retry decisions around run_call.

    Recommended fix and validation:

    1. Return exit 1 and top-level ok: false whenever the exact MCP tool result has isError: true, while preserving the raw result for diagnostics.
    2. Treat retryability conservatively. For run_call or an unknown tool, missing call_started/retry_safe metadata must not default to false/true; the request may already have caused a real-world side effect. Reuse the dedicated call-stage recovery semantics.
    3. Keep the CLI-authored error summary separate from remote text. Sanitize and bound any remote code/message, strip terminal controls and credential-shaped values, and never echo extra structured fields.
    4. Test tool success, hostile tool errors, JSON-RPC errors, run_call errors with and without side-effect metadata, arbitrary tool names, exit codes, stdout/stderr, and absence of secrets. Include the patch changeset.

    PR #128 targets the signaling bug, but its current head still republishes remote messages and defaults a generic run_call error to call_started: false / retry_safe: true; those blockers need fixing before merge.

  2. added a commit that references this issue on Nov 29, 2026
    7609e82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions