Skip to main content
MCP Tools and the x402 Facilitator SDK report failures differently — tool calls return a structured error result, the facilitator client throws. Pick your track below.
Tool calls never throw raw exceptions back to the MCP client. Every failure is returned as a structured tool result with isError: true, so the calling agent can reason about it and decide what to do next.

Tool-level error shape

Policy denials

xentfi_create_payment is checked against the agent’s Policy server-side on every call. A denied payment comes back as a tool error (not a crash), with code: "POLICY_DENIED" and a hint pointing at xentfi_get_policy.
Well-behaved agents call xentfi_get_policy proactively before a large or unusual payment, rather than waiting to be denied.

Authentication failures

A 401/403 from any tool comes back with a hint to check the agent API key. Common causes:
The stdio server logs Missing XentFi agent API key to stderr and every tool call fails identically. Fix the env block in your MCP client’s config — see essentials/agent for every client’s exact config.
xentfi_get_agent_info shows status: "SUSPENDED" or "REVOKED". Re-enable the agent or issue a new key from the dashboard.
Market-data tools (xentfi_list_blockchains, xentfi_list_tokens, price lookups) require orgId in addition to the API key — set XENTFI_ORG_ID.

Programmatic use (outside of tool handlers)

Using XentfiClient directly raises real exceptions instead of a JSON tool result:
Both map onto the platform-wide conventions in API Reference: Error Handling.