o
    *i                     @   s   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dZ	d	edefd
dZ
d	edefddZdedB ddfddZdedB ddfd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                 C   s   | j du rdS |j du rdS | j jdur,|j jdu rdS | j jjdur,|j jjdu r,dS | j jdurJ|j jdu r:dS | j jjdurJ|j jjdu rJd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    r   g/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/mcp/shared/experimental/tasks/capabilities.pycheck_tasks_capability   s"   

r   capsc                 C   @   | j du rdS | j jdu rdS | j jjdu rdS | j jjjduS )zACheck if capabilities include task-augmented elicitation support.NF)tasksr
   r   r   r   r   r   r   has_task_augmented_elicitation:      
r   c                 C   r   )z>Check if capabilities include task-augmented sampling support.NF)r   r
   r   r   r   r   r   r   has_task_augmented_samplingE   r   r   client_capsNc                 C   $   | du st | stttd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   r   r   r   "require_task_augmented_elicitationP      
r   c                 C   r   )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   r   r   r   require_task_augmented_samplingc   r    r!   )__doc__mcp.shared.exceptionsr   	mcp.typesr   r   r   r   boolr   r   r   r   r!   r   r   r   r   <module>   s    

&