+
    wi                     @    R t ^ RIHtHt ^ RIHtHt  ! R R]4      tR# )a:  
ResponseRouter - Protocol for pluggable response routing.

This module defines a protocol for routing JSON-RPC responses to alternative
handlers before falling back to the default response stream mechanism.

The primary use case is task-augmented requests: when a TaskSession enqueues
a request (like elicitation), the response needs to be routed back to the
waiting resolver instead of the normal response stream.

Design:
- Protocol-based for testability and flexibility
- Returns bool to indicate if response was handled
- Supports both success responses and errors
)AnyProtocol)	ErrorData	RequestIdc                   H   a  ] tR t^t o RtV 3R lR ltV 3R lR ltRtV tR# )ResponseRoutera  
Protocol for routing responses to alternative handlers.

Implementations check if they have a pending request for the given ID
and deliver the response/error to the appropriate handler.

Example:
    class TaskResultHandler(ResponseRouter):
        def route_response(self, request_id, response):
            resolver = self._pending_requests.pop(request_id, None)
            if resolver:
                resolver.set_result(response)
                return True
            return False
c                B   < V ^8  d   QhRS[ RS[S[S[3,          RS[/# )   
request_idresponsereturn)r   dictstrr   bool)format__classdict__s   "N/home/ubuntu/.local/lib/python3.14/site-packages/mcp/shared/response_router.py__annotate__ResponseRouter.__annotate__'   s+       d38n QU     c                    R# )z
Try to route a response to a pending request handler.

Args:
    request_id: The JSON-RPC request ID from the response
    response: The response result data

Returns:
    True if the response was handled, False otherwise
N )selfr
   r   s   &&&r   route_responseResponseRouter.route_response'        	r   c                ,   < V ^8  d   QhRS[ RS[RS[/# )r	   r
   errorr   )r   r   r   )r   r   s   "r   r   r   4   s"      i 	 d r   c                    R# )z
Try to route an error to a pending request handler.

Args:
    request_id: The JSON-RPC request ID from the error response
    error: The error data

Returns:
    True if the error was handled, False otherwise
Nr   )r   r
   r   s   &&&r   route_errorResponseRouter.route_error4   r   r   r   N)	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classdictcell__)r   s   @r   r   r      s        r   r   N)r%   typingr   r   	mcp.typesr   r   r   r   r   r   <module>r*      s     ! *)X )r   