
    kKj                        d Z ddlmZ ddlmZ 	 ddlmZ ddlmZ ddl	m
Z
 ddlmZmZmZmZmZmZmZmZmZ ddlmZ dd	lmZ ddlmZ  G d de      Zy# e$ rZ ed
      edZ[ww xY w)us  Choice — a Provider that lets the user pick from a set of options.

The LLM presents options, the user clicks one, and the selection
flows back into the conversation as a message.

Requires ``fastmcp[apps]`` (prefab-ui).

Usage::

    from fastmcp import FastMCP
    from fastmcp.apps.choice import Choice

    mcp = FastMCP("My Server")
    mcp.add_provider(Choice())
    )annotations)Literal)SetState)SendMessage)	PrefabApp)	H3ButtonCardCardContent
CardFooter
CardHeaderColumnMutedText)If)STATEzDChoice requires prefab-ui. Install with: pip install 'fastmcp[apps]'N)
FastMCPAppc                  N     e Zd ZdZ	 dddd	 	 	 	 	 	 	 d	 fdZd
dZddZ xZS )Choicea  A Provider that lets the user choose from a set of options.

    The LLM calls ``choose`` with a prompt and a list of options.
    The user sees a card with one button per option. Clicking a button
    sends the selection back into the conversation via ``SendMessage``,
    triggering the LLM's next turn.

    Example::

        from fastmcp import FastMCP
        from fastmcp.apps.choice import Choice

        mcp = FastMCP("My Server")
        mcp.add_provider(Choice())
    zChoose an Optionoutline)titlevariantc               `    t         |   |       || _        || _        | j	                          y N)super__init___title_variant_register_tools)selfnamer   r   	__class__s       d/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/fastmcp/apps/choice.pyr   zChoice.__init__?   s,     	    c                "    d| j                   dS )NzChoice())r!   )r    s    r#   __repr__zChoice.__repr__M   s    Q''r$   c                N    | | j                         	 d	 	 	 	 	 	 	 dfd       }y )Nc                   |xs j                   }t        d      5 }t               5  t        |       ddd       t	               5  t        | d       ddd       t               5  t        t        j                        5  t        d       ddd       t        t        j                         5  t        dd      5  |D ]6  }t        |j                  d	t        d
|  d|       t        dd      g       8 	 ddd       ddd       ddd       ddd       t!        ddi      S # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   TxY w# 1 sw Y   XxY w# 1 sw Y   \xY w# 1 sw Y   `xY w)u  Present the user with a set of options to choose from.

            Call this tool when you need the user to make a decision
            between discrete alternatives. Use it proactively — don't
            ask the user to type their choice in chat when you can
            present clean, clickable options instead.

            The user will see a card with one button per option. When
            they click one, their choice appears as a message in the
            conversation (as if the user typed it), like:

                "Which deployment strategy?" — I selected: Blue-green

            IMPORTANT: After calling this tool, you MUST stop and wait
            for the user's response. Do not continue or take any other
            actions until you see the "I selected:" message.

            Args:
                prompt: The question or decision to present to the user.
                options: List of options the user can choose from.
                title: Optional heading for the card.
            zmax-w-lg mx-auto)	css_classNzfont-mediumzResponse sent.   zw-full)gapr*   zw-full justify-start"u   " — I selected: decidedT)r   r*   on_clickF)viewstate)r   r
   r   r   r   r   r   r   r   r.   r   r   r	   r   r   r   r   )promptoptionsr   r   r0   optionproviders         r#   choosez&Choice._register_tools.<locals>.chooseS   s3   8 -hooF 23t\vJ " !]=9 #  \EMM*./ +U]]N+#X>*1 &$*,4,=,=.D(3./x7I&,R)* )1D(A	.&	
!" +2 ? , " 42  %( 1 "\ #] +* ?> ,+ "\ 43s   E1D)E1D5E1'E%E"E%/E=<E	:EE%
E1)D2	.E15D>	:E1E
E%EEE"E%%E.	*E11E:r   )r2   strr3   z	list[str]r   z
str | Nonereturnr   )ui)r    r6   r5   s     @r#   r   zChoice._register_toolsP   sI    	 !%9	9	9	 9	 	9	 
9	r$   )r   )r!   r7   r   r7   r   z?Literal['default', 'outline', 'destructive', 'success', 'info']r8   None)r8   r7   )r8   r:   )__name__
__module____qualname____doc__r   r'   r   __classcell__)r"   s   @r#   r   r   .   sQ    $  (  	

 
(=r$   r   )r>   
__future__r   typingr   prefab_ui.actionsr   prefab_ui.actions.mcpr   prefab_ui.appr   prefab_ui.componentsr   r	   r
   r   r   r   r   r   r   !prefab_ui.components.control_flowr   prefab_ui.rxr   ImportError_excfastmcp.apps.appr   r    r$   r#   <module>rL      so     # *1'
 
 
 5" (_Z _  
Ns   4A A)	A$$A)