
    Ki                         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y)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                   y|j                   y| j                   j                  X|j                   j                  y| j                   j                  j                  !|j                   j                  j                  y| j                   j                  X|j                   j                  y| j                   j                  j                  !|j                   j                  j                  yy)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
    TF)requestselicitationcreatesamplingcreateMessage)r   r	   s     v/home/jay/workspace/scripts/.codegraph-venv/lib/python3.12/site-packages/mcp/shared/experimental/tasks/capabilities.pycheck_tasks_capabilityr      s       $$0??&&.((//;**119 !!-??##+%%33?''55=    capsc                     | j                   y| j                   j                  y| j                   j                  j                  y| 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   :   s\    zzzz"zz&&.::**11==r   c                     | j                   y| j                   j                  y| j                   j                  j                  y| 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   s\    zzzz"zz##+::''55TAAr   client_capsNc                 R    | t        |       st        t        t        d            y)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   s3     "@"M$L
 	
 #Nr   c                 R    | t        |       st        t        t        d            y)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   s3     "=k"J$I
 	
 #Kr   )__doc__mcp.shared.exceptionsr   	mcp.typesr   r   r   r   boolr   r   r   r!   r#    r   r   <module>r)      s    + ###!# 
#L>); > >B&8 BT B
4F4M 
RV 
&
1Cd1J 
t 
r   