
    )`i                         d Z ddlmZ ddlmZmZmZmZ dededefdZ	dedefd	Z
dedefd
Zdedz  ddfdZdedz  ddfdZdS )a  
Tasks capability checking utilities.

This module provides functions for checking and requiring task-related
capabilities. All tasks capability logic is centralized here to keep
the main session code clean.

WARNING: These APIs are experimental and may change without notice.
    )McpError)INVALID_REQUESTClientCapabilitiesClientTasksCapability	ErrorDatarequiredclientreturnc                 "   | j         dS |j         dS | j         j        2|j         j        dS | j         j        j        |j         j        j        dS | j         j        2|j         j        dS | j         j        j        |j         j        j        dS dS )a  
    Check if client's tasks capability matches the required capability.

    Args:
        required: The capability being checked for
        client: The client's declared capabilities

    Returns:
        True if client has the required capability, False otherwise
    NTF)requestselicitationcreatesamplingcreateMessage)r   r	   s     ~/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/mcp/shared/experimental/tasks/capabilities.pycheck_tasks_capabilityr      s      tu $0?&.5(/;*19u !-?#+5%3?'5=u4    capsc                     | j         dS | j         j        dS | j         j        j        dS | j         j        j        j        duS )zACheck if capabilities include task-augmented elicitation support.NF)tasksr   r   r   r   s    r   has_task_augmented_elicitationr   :   sH    zuz"uz&.u:*1==r   c                     | j         dS | j         j        dS | j         j        j        dS | j         j        j        j        duS )z>Check if capabilities include task-augmented sampling support.NF)r   r   r   r   r   s    r   has_task_augmented_samplingr   E   sH    zuz"uz#+u:'5TAAr   client_capsNc                 n    | t          |           s#t          t          t          d                    dS )a  
    Raise McpError if client doesn't support task-augmented elicitation.

    Args:
        client_caps: The client's declared capabilities, or None if not initialized

    Raises:
        McpError: If client doesn't support task-augmented elicitation
    Nz2Client does not support task-augmented elicitationcodemessage)r   r   r   r   r   s    r   "require_task_augmented_elicitationr!   P   sJ     "@"M"M$L  
 
 	
 r   c                 n    | t          |           s#t          t          t          d                    dS )z
    Raise McpError if client doesn't support task-augmented sampling.

    Args:
        client_caps: The client's declared capabilities, or None if not initialized

    Raises:
        McpError: If client doesn't support task-augmented sampling
    Nz/Client does not support task-augmented samplingr   )r   r   r   r   r    s    r   require_task_augmented_samplingr#   c   sJ     "=k"J"J$I  
 
 	
 r   )__doc__mcp.shared.exceptionsr   	mcp.typesr   r   r   r   boolr   r   r   r!   r#    r   r   <module>r)      s5    + * * * * *           ###!# 
# # # #L>); > > > > >B&8 BT B B B B
4F4M 
RV 
 
 
 
&
1Cd1J 
t 
 
 
 
 
 
r   