Skip to content

Raised AdcpError only fills adcp_error, so storyboards that read errors[0] fail #1558

Description

@austinwiltshire

build_mcp_error_result (src/adcp/server/translate.py) builds structuredContent as {"adcp_error": {...}} only. The error-handling docs say a fatal failure SHOULD populate both layers:

A fatal task failure SHOULD populate both layers. The payload carries the structured errors[] array that any protocol can read verbatim, and the transport envelope carries adcp_error…

https://docs.adcontextprotocol.org/dist/docs/3.2.3/building/by-layer/L3/error-handling (same text in 3.1.27 and on main)

This bites in practice: media_buy_seller/product_signal_targeting, step create_media_buy_with_unknown_signal, checks field_value at errors[0].field (3.1.1 through 3.2.5, and the current source). A seller that raises AdcpError, the path the docs recommend, gets isError: true with only adcp_error and fails that step.

Repro: raise AdcpError("INVALID_REQUEST", field="packages[0]...", ...) from a create_media_buy handler and run the storyboard. The error_code check passes; the errors[0].field check gets null.

Suggested fix: one line in build_mcp_error_result:

structured: dict[str, Any] = {"adcp_error": adcp_error, "errors": [adcp_error]}

Until then, sellers can do it themselves with a response_enhancer:

def mirror_adcp_error_to_errors(response: dict[str, Any]) -> None:
    if "adcp_error" in response and "errors" not in response:
        response["errors"] = [response["adcp_error"]]

Checked against 6.4.0, 8.1.3, and main.

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