Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/_experimental/mcp_server/faults/__init__.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:01 +0000

1"""Typed fault values for upstream OAuth/DCR failures (phase 1 of the MCP error-handling framework). 

2 

3The invariant this package exists to enforce: an upstream failure is classified ONCE into a single 

4fault value, and the response status, wire error code, and prose are all derived from that value. 

5Deriving all three from one classification makes contradictory pairings (a caller-fault error code on 

6a server-fault status) unrepresentable, and gives the trust-boundary rule one enforcement point: 

7spec-defined machine fields may cross to callers, upstream prose and raw bodies go to server logs. 

8""" 

9 

10from litellm.proxy._experimental.mcp_server.faults.classify import ( 

11 classify_upstream_dcr_rejection, 

12 classify_upstream_token_rejection, 

13) 

14from litellm.proxy._experimental.mcp_server.faults.render_oauth import ( 

15 dcr_fault_detail, 

16 render_token_fault, 

17) 

18from litellm.proxy._experimental.mcp_server.faults.traversal import iter_exception_tree 

19from litellm.proxy._experimental.mcp_server.faults.types import ( 

20 CallerRejected, 

21 CredentialSource, 

22 GatewayRejected, 

23 UpstreamOAuthFault, 

24 UpstreamProtocolFault, 

25 UpstreamRegistrationRefused, 

26 UpstreamReportedFault, 

27) 

28 

29__all__ = [ 

30 "CallerRejected", 

31 "CredentialSource", 

32 "GatewayRejected", 

33 "UpstreamOAuthFault", 

34 "UpstreamProtocolFault", 

35 "UpstreamRegistrationRefused", 

36 "UpstreamReportedFault", 

37 "classify_upstream_dcr_rejection", 

38 "classify_upstream_token_rejection", 

39 "dcr_fault_detail", 

40 "iter_exception_tree", 

41 "render_token_fault", 

42]