Skip to main content
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 — retry, adjust arguments, or explain the failure to a human.

Tool-level error shape

Policy denials

xentfi_create_payment is checked against the agent’s Policy server-side on every call, regardless of what the client validated beforehand. A denied payment comes back as a tool error (not a crash), with code: "POLICY_DENIED" and a hint pointing the agent at xentfi_get_policy to inspect current limits and spend before retrying with different parameters.
Well-behaved agents call xentfi_get_policy proactively before a large or unusual payment, rather than waiting to be denied. It’s a cheap read and avoids a wasted round trip.

Authentication failures

A 401/403 from any tool comes back with hint: "Check that the agent API key is valid and has not been revoked or suspended." 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 the client-specific guide (e.g. Claude Desktop).
xentfi_get_agent_info will show status: "SUSPENDED" or "REVOKED". Re-enable the agent or issue a new key from the dashboard.
A sandbox key against production XENTFI_BASE_URL (or vice versa) returns 401. Double check XENTFI_BASE_URL matches the environment the key was issued in.

Programmatic use (outside of tool handlers)

If you’re using XentfiClient directly rather than through the MCP tool layer, failures raise real exceptions instead of a JSON tool result:
See API Reference: Error Handling for the full HTTP status and error-code tables that these map to.